Skip to content

code clean #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tensorflow/core/grappler/optimizers/remapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,9 @@ bool FindContractionWithBiasAddAndAdd(const RemapperContext& ctx,
bool SharedInputWithMatMul(const RemapperContext& ctx, int node_index,
int node_dz) {
const auto* node_view = ctx.graph_view.GetNode(node_index);
if (node_view == nullptr) return false;
const auto* shared_input = node_view->GetRegularFanin(0).node_view();
if (shared_input == nullptr) return false;
if (shared_input->node_index() == node_dz) {
shared_input = node_view->GetRegularFanin(1).node_view();
}
Expand All @@ -733,6 +735,7 @@ bool SharedInputWithMatMul(const RemapperContext& ctx, int node_index,
bool FindContractionWithBiasAddGrad(const RemapperContext& ctx, int node_index,
ContractionWithBiasAddGrad* matched) {
const auto* node_view = ctx.graph_view.GetNode(node_index);
if (node_view == nullptr) return false;
// TODO(lyandy): Forward controls for patterns with control dependencies.
if (HasControlFaninOrFanout(*node_view)) return false;

Expand Down Expand Up @@ -764,6 +767,7 @@ bool FindContractionWithBiasAddGrad(const RemapperContext& ctx, int node_index,
// the forward input with index 0.

const auto* dz = node_view->GetRegularFanin(0).node_view();
if (dz == nullptr) return false;
// The node index for MatMulGradFilter if found.
int matmul_grad_filter_idx = -1;

Expand Down Expand Up @@ -1838,6 +1842,7 @@ Status AddBatchNormNodes(RemapperContext* ctx, const FusedBatchNorm& matched) {
#ifdef INTEL_MKL
bool IsConv2DWithAdd(const RemapperContext& ctx, int node_index) {
const auto* node_view = ctx.graph_view.GetNode(node_index);
if (node_view == nullptr) return false;
const auto* node_def = node_view->node();

// Candidate for Conv2D + Add or Conv2D + BiasAdd + Add fusion.
Expand Down