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

Update fold_old_batch_norms.cc to accommodate 'NCHW' format. #17602

Merged
merged 5 commits into from
Apr 26, 2018

Conversation

joeyearsley
Copy link
Contributor

Fixes the problem of using fused batch normalization and this transform, only shows up when using 'NCHW' as the default is 'NHWC'.

Fixes the problem of using fused batch normalization and this transform, only shows up when using 'NCHW' as the default is 'NHWC'.
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers
  • Your company has a Point of Contact who decides which employees are authorized to participate. Ask your POC to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • The email used to register you as an authorized contributor must be the email used for the Git commit. Check your existing CLA data and verify that your email is set on your git commits.
  • The email used to register you as an authorized contributor must also be attached to your GitHub account.

@joeyearsley
Copy link
Contributor Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Mar 9, 2018
@frankchn frankchn added awaiting review Pull request awaiting review kokoro:force-run Tests on submitted change labels Mar 13, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Mar 13, 2018
@@ -159,6 +159,7 @@ Status FuseScaleOffsetToConvWeights(const std::vector<float>& scale_values,
NodeDef bias_add_node;
bias_add_node.set_op("BiasAdd");
bias_add_node.set_name(conv_output_name);
CopyNodeAttr(conv_node, "data_format", "data_format", &bias_add_node);
Copy link
Contributor

Choose a reason for hiding this comment

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

This would fail the whole program if the conv_node doesn't have "data_format" attribute. You probably need to first verify it has the attribute "data_format" before calling CopyNodeAttr?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see any checks like this in any other part of the code, please could you direct me to some.

Also, since it is now part of the api in tf.nn.conv2d does it not get this attribute regardless? - I'm not sure but I thought that it would fallback to the default.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is just an extra safety check for legacy tf graphs. You are right, If the original graph is created with tf.nn.conv2d, then this check is not needed; but I am not whether there are any legacy tf graphs that do not contain this attr.

@joeyearsley
Copy link
Contributor Author

@mingxingtan Added the check as requested.

@martinwicke martinwicke self-assigned this Apr 16, 2018
@martinwicke
Copy link
Member

@mingxingtan can you take another look?

@@ -159,6 +159,9 @@ Status FuseScaleOffsetToConvWeights(const std::vector<float>& scale_values,
NodeDef bias_add_node;
bias_add_node.set_op("BiasAdd");
bias_add_node.set_name(conv_output_name);
if (HasAttr(conv_node, "data_format")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see where is HasAttr defined. Maybe you can directly use something like:

if (!conv_node.attr().count("data_format")) {
  CopyNodeAttr(conv_node, "data_format", "data_format", &bias_add_node);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated as requested

@martinwicke martinwicke added stat:awaiting response Status - Awaiting response from author and removed awaiting review Pull request awaiting review labels Apr 19, 2018
Updated as requested
@martinwicke martinwicke added awaiting testing (then merge) kokoro:force-run Tests on submitted change and removed stat:awaiting response Status - Awaiting response from author labels Apr 23, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Apr 23, 2018
@martinwicke martinwicke merged commit 4bd6ac7 into tensorflow:master Apr 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants