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/16 18:44:14 UTC

[GitHub] [incubator-mxnet] roywei commented on a change in pull request #14869: Fix infer shape partial after unknown shape changed to -1

roywei commented on a change in pull request #14869: Fix infer shape partial after unknown shape changed to -1
URL: https://github.com/apache/incubator-mxnet/pull/14869#discussion_r284847219
 
 

 ##########
 File path: src/operator/tensor/dot-inl.h
 ##########
 @@ -1207,6 +1207,12 @@ inline bool DotShape(const nnvm::NodeAttrs& attrs,
   CHECK_EQ(out_attrs->size(), 1U);
   mxnet::TShape& lshape = (*in_attrs)[0];
   mxnet::TShape& rshape = (*in_attrs)[1];
+  // return false if lhs and rhs both have fully unknown shape
+  if (!ndim_is_known(lshape) || !ndim_is_known(rshape)) return false;
+  // only partially infer shape if last dim of lhs and first dim of rhs is known
+  bool last_dim_known = dim_size_is_known(lshape, lshape.ndim() > 1 ? lshape.ndim() - 1 : 0);
+  bool first_dim_known = dim_size_is_known(rshape, 0);
 
 Review comment:
   updated the check to:
   lhs ndim > 1, and last dim known
   rhs ndim > 1, and first dim known
   
   but this will silently return false if ndim < -1. 
   We may need more types of checks in addition to `ndim_is_known` and `shape_is_known`. 
   

----------------------------------------------------------------
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