Enable Squeeze fusion in grappler
This commit is contained in:
parent
e96e745fe3
commit
afd8d97ae1
tensorflow/core/grappler/optimizers
@ -1867,13 +1867,10 @@ Status Remapper::Optimize(Cluster* cluster, const GrapplerItem& item,
|
||||
continue;
|
||||
}
|
||||
|
||||
// NOTE: We can only fuse BatchNorm into Conv2D nodes. In theory we can do
|
||||
// it for MatMul as well, but in practice this pattern does not appear in
|
||||
// real Tensorflow graphs.
|
||||
// NOTE: We can only fuse BatchNorm into Conv2D nodes. In theory we can do
|
||||
// it for MatMul as well, but in practice this pattern does not appear in
|
||||
// real Tensorflow graphs.
|
||||
|
||||
// TODO(penporn):
|
||||
// Remove this once TF-MKL supports _FusedConv2D with these operations.
|
||||
#ifndef INTEL_MKL
|
||||
// Remap Conv2D+Squeeze+BiasAdd into the _FusedConv2D+Squeeze.
|
||||
ContractionWithSqueezeAndBiasAdd contract_with_squeeze_and_bias;
|
||||
if (allow_non_differentiable_rewrites &&
|
||||
@ -1884,6 +1881,9 @@ Status Remapper::Optimize(Cluster* cluster, const GrapplerItem& item,
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO(intel-tf):
|
||||
// Remove this once TF-MKL supports _FusedConv2D with these operations.
|
||||
#ifndef INTEL_MKL
|
||||
// Remap Conv2D+FusedBatchNorm into the _FusedConv2D;
|
||||
ContractionWithBatchNorm contract_with_batch_norm;
|
||||
if (allow_non_differentiable_rewrites &&
|
||||
|
@ -932,6 +932,7 @@ TEST_F(RemapperTest, FuseConv2DWithBatchNormAndActivation) {
|
||||
test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6);
|
||||
}
|
||||
}
|
||||
#endif // !INTEL_MKL
|
||||
|
||||
TEST_F(RemapperTest, FuseConv2DWithSqueezeAndBias) {
|
||||
using ops::Placeholder;
|
||||
@ -1003,7 +1004,6 @@ TEST_F(RemapperTest, FuseConv2DWithSqueezeAndBias) {
|
||||
ASSERT_EQ(tensors.size(), 1);
|
||||
test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6);
|
||||
}
|
||||
#endif // !INTEL_MKL
|
||||
|
||||
} // namespace grappler
|
||||
} // namespace tensorflow
|
||||
|
Loading…
Reference in New Issue
Block a user