Skip to content
Permalink
Browse files Browse the repository at this point in the history
Add missing validation to pooling_ops_3d
PiperOrigin-RevId: 372218727
Change-Id: I6b9ed4266aa7286c02f1f230d7bea922c1be547e
  • Loading branch information
mihaimaruseac authored and tensorflower-gardener committed May 5, 2021
1 parent 72fe792 commit a3d9f9b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tensorflow/core/kernels/pooling_ops_3d.cc
Expand Up @@ -698,6 +698,19 @@ class MaxPooling3dGradGradOp : public OpKernel {
OP_REQUIRES_OK(context, context->forward_input_or_allocate_output(
{2}, 0, tensor_out.shape(), &output));

// Given access patterns in LaunchMaxPooling3dGradGradOp, these tensors must
// have elements.
OP_REQUIRES(context, tensor_in.NumElements() > 0,
errors::InvalidArgument("received empty tensor tensor_in: ",
tensor_in.DebugString()));
OP_REQUIRES(context, tensor_out.NumElements() > 0,
errors::InvalidArgument("received empty tensor tensor_out: ",
tensor_out.DebugString()));
OP_REQUIRES(
context, out_grad_backprop.NumElements() > 0,
errors::InvalidArgument("received empty tensor out_grad_backprop: ",
out_grad_backprop.DebugString()));

LaunchMaxPooling3dGradGradOp<Device, T>::launch(
context, params, tensor_in, tensor_out, out_grad_backprop, output);
}
Expand Down

0 comments on commit a3d9f9b

Please sign in to comment.