Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
test CI 4
Browse files Browse the repository at this point in the history
fix sanity error
  • Loading branch information
JiangZhaoh committed Feb 13, 2020
1 parent dcd55e0 commit 465de98
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/operator/numpy/np_insert_op.cu
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
namespace mxnet {
namespace op {

NNVM_REGISTER_OP(_npi_insert);
NNVM_REGISTER_OP(_npi_insert)
.set_attr<FCompute>("FCompute<gpu>", NumpyInsertCompute<gpu>);

}
Expand Down
9 changes: 3 additions & 6 deletions src/operator/numpy/np_insert_op_tensor_indices-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
* \file np_insert_op-inl.h
* \brief Function definition of insert operators
*/
#ifndef MXNET_OPERATOR_NUMPY_NP_INSERT_OP_INDICES_INL_H_
#define MXNET_OPERATOR_NUMPY_NP_INSERT_OP_INDICES_INL_H_
#ifndef MXNET_OPERATOR_NUMPY_NP_INSERT_OP_TENSOR_INDICES_INL_H_
#define MXNET_OPERATOR_NUMPY_NP_INSERT_OP_TENSOR_INDICES_INL_H_

#include <vector>
#include <memory>
Expand Down Expand Up @@ -67,7 +67,6 @@ void NumpyInsertTensorIndicesCompute(const nnvm::NodeAttrs& attrs,
const NumpyInsertTensorParam& param = nnvm::get<NumpyInsertTensorParam>(attrs.parsed);
int input_count = param.val.has_value() ? 1 : 2;
int insize = input_count + 1;
bool obj_is_tensor = true;
CHECK_EQ(inputs.size(), insize);
CHECK_EQ(outputs.size(), 1);
CHECK_EQ(req.size(), 1);
Expand Down Expand Up @@ -98,7 +97,6 @@ void NumpyInsertTensorIndicesCompute(const nnvm::NodeAttrs& attrs,

// get and check indices from tensor
int numnew = 0; // numnew = output.shape[axis] - arr.shape[axis]
int index = 0; // save modified index, because index may be negative integer
mxnet::TShape val_newshape(arr.shape_.ndim(), -1);
// modify values's ndim to arr's ndim, for broadcast easily later
// e.g. value shape: (2,) arr shape: (3, 2) => value shape: (1, 2)
Expand Down Expand Up @@ -193,12 +191,11 @@ void NumpyInsertTensorIndicesCompute(const nnvm::NodeAttrs& attrs,
outshape.get<ndim>(), values.shape_.get<ndim>(),
is_insert, origin_idx, dtype, vtype, req[out_pos],
axis, outshape.Size());

});
}
}

} // namespace op
} // namespace mxnet

#endif // MXNET_OPERATOR_NUMPY_NP_INSERT_OP_INDICES_INL_H_
#endif // MXNET_OPERATOR_NUMPY_NP_INSERT_OP_TENSOR_INDICES_INL_H_
3 changes: 0 additions & 3 deletions src/operator/numpy/np_insert_op_tensor_indices.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,16 @@ bool NumpyInsertTensorIndicesShape(const nnvm::NodeAttrs& attrs,

out_shape->clear();

int ndim = arrshape.ndim();
int axis = param.axis.has_value() ? param.axis.value() : 0;
if (!(param.axis.has_value())) {
arrshape = Shape1(arrshape.Size());
ndim = 1;
} else {
CHECK(axis >= -1 * arrshape.ndim() && axis < arrshape.ndim())
<< "Axis should be in the range of [-r, r-1] where r is the rank of input tensor";
axis += (axis < 0) ? arrshape.ndim() : 0;
}

int seq_cnt = -1;
int N = arrshape[axis];
seq_cnt = objShape.Size();

mxnet::TShape newshape(arrshape);
Expand Down
7 changes: 4 additions & 3 deletions src/operator/numpy/np_insert_op_tensor_indices.cu
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@

/*!
* Copyright (c) 2019 by Contributors
* \file np_insert_op.cu
* \file np_insert_op_tensor_indices.cu
* \brief GPU Implementation of numpy insert operations
*/

#include "./np_insert_op-inl.h"
#include "./np_insert_op_tensor_indices-inl.h"

namespace mxnet {
namespace op {

NNVM_REGISTER_OP(_npi_insert_tensor_indices)
.set_attr<FCompute>("FCompute<gpu>", NumpyInsertCompute<gpu>);
.set_attr<FCompute>("FCompute<gpu>", NumpyInsertTensorIndicesCompute<gpu>);

}
}

0 comments on commit 465de98

Please sign in to comment.