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 2018/06/28 22:36:24 UTC

[GitHub] sandeep-krishnamurthy commented on a change in pull request #11406: [MXNET-599] Partial shape infer for Slice

sandeep-krishnamurthy commented on a change in pull request #11406: [MXNET-599] Partial shape infer for Slice
URL: https://github.com/apache/incubator-mxnet/pull/11406#discussion_r199007699
 
 

 ##########
 File path: src/operator/tensor/matrix_op-inl.h
 ##########
 @@ -674,13 +675,23 @@ inline void SetSliceOpOutputDimSize(const index_t i, const int b,
                                     const int e, const int s,
                                     TShape* oshape) {
   if (s > 0) {
-    CHECK_LT(b, e) << "slicing with begin=[" << i << "]=" << b << ", end[" << i << "]="
+    CHECK_LE(b, e) << "slicing with begin=[" << i << "]=" << b << ", end[" << i << "]="
                    << e << ", and step[" << i << "]=" << s << " is invalid";
-    (*oshape)[i] = (e - b - 1) / s + 1;
+    if (e == b) {
+      // for partial shape infer
+      (*oshape)[i] = 0;
+    } else {
+      (*oshape)[i] = (e - b - 1) / s + 1;
 
 Review comment:
   Yes that is correct. Even if one of the shape is unknown (0) we cannot/should not infer output shape. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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