pengzhao-intel commented on a change in pull request #15031: [Quantization]
Support zero-size tensor input for quantization flow
URL: https://github.com/apache/incubator-mxnet/pull/15031#discussion_r286371250
##########
File path: src/operator/quantization/quantize-inl.h
##########
@@ -119,13 +119,20 @@ inline bool QuantizeShape(const nnvm::NodeAttrs& attrs,
CHECK_EQ(in_attrs->size(), 3U);
CHECK_EQ(out_attrs->size(), 3U);
+ mxnet::TShape dshape = (*in_attrs)[0];
for (size_t i = 1; i < 3; ++i) {
SHAPE_ASSIGN_CHECK(*in_attrs, i, mxnet::TShape(1, 1));
}
SHAPE_ASSIGN_CHECK(*out_attrs, 0, in_attrs->at(0));
- SHAPE_ASSIGN_CHECK(*out_attrs, 1, mxnet::TShape{1});
- SHAPE_ASSIGN_CHECK(*out_attrs, 2, mxnet::TShape{1});
+ SHAPE_ASSIGN_CHECK(*out_attrs, 1, mxnet::TShape(1, 1));
+ SHAPE_ASSIGN_CHECK(*out_attrs, 2, mxnet::TShape(1, 1));
+
+ if ((*out_attrs)[0].ndim() > 0) {
+ dshape[0] = ((*out_attrs)[0])[0];
+ SHAPE_ASSIGN_CHECK(*in_attrs, 0, dshape);
+ }
Review comment:
Agree with this :)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services