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

Don't do any work if output tensor is null (prevent div by 0) #49657

Merged
merged 1 commit into from May 26, 2021
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
2 changes: 2 additions & 0 deletions tensorflow/core/kernels/maxpooling_op.cc
Expand Up @@ -1077,6 +1077,8 @@ class MaxPoolingGradWithArgmaxOp : public OpKernel {
OP_REQUIRES_OK(context, context->forward_input_or_allocate_output(
{0}, 0, out_shape, &grad_out));

if (out_shape.num_elements() == 0) return; // nothing to be done

LaunchMaxPoolingGradWithArgmax<Device, T>::launch(
context, params, grad_in, argmax, grad_out, include_batch_in_index_);
}
Expand Down