Merge pull request #46838 from around-star:fix-crashing-of-the-runtime-with-kernel-size-0

PiperOrigin-RevId: 356987452
Change-Id: I95790ccae67f77c63fd8825b08755ea721dd4924
This commit is contained in:
TensorFlower Gardener 2021-02-11 09:14:07 -08:00
commit 6129ab977c

View File

@ -77,6 +77,11 @@ class AvgPoolingOp : public UnaryOp<T> {
OP_REQUIRES(context, ksize_[0] == 1 && stride_[0] == 1,
errors::Unimplemented(
"Pooling is not yet supported on the batch dimension."));
for (int i = 0; i < ksize_.size(); ++i) {
OP_REQUIRES(context, ksize_[i] != 0,
errors::InvalidArgument("ksize cannot be zero"));
}
}
void Compute(OpKernelContext* context) override {