You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/05/22 06:10:47 UTC
[GitHub] [incubator-mxnet] pengzhao-intel commented on a change in pull
request #15031: [Quantization] Support zero-size tensor input for
quantization flow
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_r286325849
##########
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:
Could we abstract this as a small function?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services