Skip to content
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

[Intel MKL]code cleanup #33703

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 9 additions & 8 deletions tensorflow/core/grappler/optimizers/remapper.cc
Expand Up @@ -573,6 +573,7 @@ bool FindContractionWithBiasInPort(const RemapperContext& ctx,
if (add_node_view.NumRegularFanins() < port_id + 1) return false;
const auto& bias_add_node_view =
add_node_view.GetRegularFanin(port_id).node_view();
if (bias_add_node_view == nullptr) return false;
const auto* bias_add_node_def = bias_add_node_view->node();

if (!FindContractionWithBias(ctx, bias_add_node_view->node_index(), base,
Expand Down Expand Up @@ -637,6 +638,7 @@ bool FindContractionWithBiasAndAddActivation(

// Root of the pattern must be an activation node.
const auto* node_def = node_view->node();
if (node_def == nullptr) return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this happen in practice? It's probably a bug somewhere if node def in null.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ezhulenev No, this just pass some tools check.

if (!IsSupportedActivation(*node_def)) return false;

// MKL activation op only supports float data type.
Expand Down Expand Up @@ -1208,14 +1210,13 @@ Status AddFusedBatchNormExNode(RemapperContext* ctx,
const NodeDef& activation = graph->node(matched.activation);

VLOG(2) << "Fuse " << activation.op() << " with FusedBatchNorm:"
<< " activation=" << activation.name() << " side_input="
<< (matched.side_input != kMissingIndex
? graph->node(matched.side_input).name()
: "<none>")
<< " invalidated="
<< (matched.invalidated != kMissingIndex
? graph->node(matched.invalidated).name()
: "<none>")
<< " activation=" << activation.name()
<< " side_input=" << (matched.side_input != kMissingIndex
? graph->node(matched.side_input).name()
: "<none>")
<< " invalidated=" << (matched.invalidated != kMissingIndex
? graph->node(matched.invalidated).name()
: "<none>")
<< " fused_batch_norm=" << fused_batch_norm.name();

// Replace FusedBatchNorm with _FusedBatchNormEx + <SideInput> + <Activation>.
Expand Down