samskalicky commented on a change in pull request #12430: [MXNET-882] Support
for N-d arrays added to diag op.
URL: https://github.com/apache/incubator-mxnet/pull/12430#discussion_r216771144
##########
File path: src/operator/tensor/diag_op-inl.h
##########
@@ -69,7 +87,21 @@ inline TShape DiagShapeImpl(const TShape& ishape, const
nnvm::dim_t k) {
s = 0;
}
- return TShape({s});
+ if (x1 > x2) {
+ std::swap(x1, x2);
+ }
+
+ int n_dim = static_cast<int>(ishape.ndim()) - 1;
Review comment:
if the input shape is 1D then there is no diagonal for it. This code will
not be executed.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services