You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by bg...@apache.org on 2022/06/23 07:38:54 UTC

[incubator-mxnet] branch v1.x updated: [BUGFIX] Fix mkldnn segfault in reshape operator (#21056)

This is an automated email from the ASF dual-hosted git repository.

bgawrych pushed a commit to branch v1.x
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/v1.x by this push:
     new 1eeda3357b [BUGFIX] Fix mkldnn segfault in reshape operator  (#21056)
1eeda3357b is described below

commit 1eeda3357b967da3e5852b0d6440a35281488d73
Author: RafLit <ra...@intel.com>
AuthorDate: Thu Jun 23 09:38:47 2022 +0200

    [BUGFIX] Fix mkldnn segfault in reshape operator  (#21056)
    
    * check shape size in reshape
    
    * formatting
    
    * add newline in error msg
---
 src/operator/tensor/matrix_op-inl.h | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/operator/tensor/matrix_op-inl.h b/src/operator/tensor/matrix_op-inl.h
index 46bb20a880..13dc28c34f 100644
--- a/src/operator/tensor/matrix_op-inl.h
+++ b/src/operator/tensor/matrix_op-inl.h
@@ -225,12 +225,11 @@ inline bool ReshapeShape(const nnvm::NodeAttrs& attrs,
            && ReverseReshapeInferShape(&(*in_attrs)[0], (*out_attrs)[0]);
   }
   ReverseReshapeInferShape(&dshape, oshape);
-#if 0
-  CHECK_EQ(oshape.Size(), dshape.Size())
-    << "Target shape size is different to source. "
-    << "Target: " << oshape
-    << "\nSource: " << dshape;
-#endif
+  if (shape_is_known(dshape) && shape_is_known(oshape)) {
+    CHECK_EQ(oshape.Size(), dshape.Size())
+        << "Target shape size is different to source.\n"
+        << "Target: " << oshape << "\nSource: " << dshape;
+  }
   SHAPE_ASSIGN_CHECK(*out_attrs, 0, oshape);
   return ReverseReshapeInferShape(&(*in_attrs)[0], (*out_attrs)[0]);
 }