Commit a0c653b6 authored by Piotr Padlewski's avatar Piotr Padlewski Committed by TensorFlower Gardener
Browse files

Map and filter fusion

This patch introduces MapAndFilterFusion optimization, e.g:
map(map_fun).filter(filter_fun)

It moves computation of filter_fun to the map_fun, which returns the computed element and computed predicate. Filter is replaced with FilterByLastComponentDataset, which
filters by the boolean, resulting in:

map(fused_fun).FilterByLastComponent()
where:
  fused_fun(x):
    r = map_function(x)
    return (r, filter_fun(r))

The micro benchmark shows around 68% improvement (chain of 50 map-filter)

PiperOrigin-RevId: 207624667
parent 28cdc5f6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment