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_r215367191
##########
File path: src/operator/tensor/diag_op-inl.h
##########
@@ -30,33 +30,46 @@
#include <dmlc/parameter.h>
#include <vector>
#include <algorithm>
+#include <utility>
#include "../mxnet_op.h"
#include "../operator_common.h"
#include "../elemwise_op_common.h"
+#include "./broadcast_reduce_op.h"
namespace mxnet {
namespace op {
struct DiagParam : public dmlc::Parameter<DiagParam> {
dmlc::optional<int> k;
+ dmlc::optional<int> axis1;
+ dmlc::optional<int> axis2;
DMLC_DECLARE_PARAMETER(DiagParam) {
DMLC_DECLARE_FIELD(k)
.set_default(dmlc::optional<int>(0))
.describe("Diagonal in question. The default is 0. "
"Use k>0 for diagonals above the main diagonal, "
"and k<0 for diagonals below the main diagonal. "
"If input has shape (S0 S1) k must be between -S0 and S1");
+ DMLC_DECLARE_FIELD(axis1)
+ .set_default(dmlc::optional<int>(0))
Review comment:
Would it be better to use unsigned here instead of int since the axes cannot
be negative?
----------------------------------------------------------------
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