提交 3ef97d1e 编写于 作者: A A. Unique TensorFlower 提交者: TensorFlower Gardener

Generate informative error when attempting to execute SummaryImageOp with trivial dimensions.

This bypasses a nullptr error that appears downstream due to referencing a length-zero array in a temporary buffer.

PiperOrigin-RevId: 224915050
上级 13763899
......@@ -78,6 +78,11 @@ class SummaryImageOp : public OpKernel {
const int hw = h * w; // Compact these two dims for simplicity
const int depth = static_cast<int>(tensor.dim_size(3));
OP_REQUIRES(c, hw > 0 && depth > 0,
errors::InvalidArgument(
"input tensor must have non-zero dims. Found: [",
batch_size, ", ", h, ", ", w, ", ", depth, "]."));
Summary s;
if (tensor.dtype() == DT_UINT8) {
// For uint8 input, no normalization is necessary
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册