Skip to content

Commit

Permalink
Fix breaking changes after pull master (apache#3291)
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen committed Sep 15, 2016
1 parent 8713ba3 commit c0a422c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
31 changes: 9 additions & 22 deletions src/ndarray/ndarray.cc
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ void ScalarOp(const NDArray &lhs,

void CopySliceTo(const NDArray &from, int slice_dim, index_t start, index_t end,
NDArray *to, int priority) {
CHECK(from.shape().ndim() == to->shape().ndim())
CHECK_EQ(from.shape().ndim(), to->shape().ndim())
<< "from and to must have the same number of dimensions";
CHECK(slice_dim < from.shape().ndim())
CHECK_LT(slice_dim, static_cast<int>(from.shape().ndim()))
<< "slice dimension out of bounds";
CHECK(start < end)
CHECK_LT(start, end)
<< "slice is empty";
CHECK(end < from.shape()[slice_dim])
CHECK_LT(end, from.shape()[slice_dim])
<< "slice out of bounds";

mshadow::Shape<3> from_shape = from.shape().FlatTo3D(slice_dim);
Expand Down Expand Up @@ -820,24 +820,11 @@ MXNET_REGISTER_NDARRAY_FUN(_copy_slice_to)
.set_num_use_vars(1)
.set_num_scalars(3)
.set_num_mutate_vars(1)
.set_type_mask(kNDArrayArgBeforeScalar);

// register random number generators
MXNET_REGISTER_NDARRAY_FUN(_random_uniform)
.set_body([](NDArray **u, real_t *s, NDArray **out,
int num_params, char **param_keys, char **param_vals) {
SampleUniform(s[0], s[1], out[0]);
})
.set_num_scalars(2)
.set_num_mutate_vars(1);

MXNET_REGISTER_NDARRAY_FUN(_random_gaussian)
.set_body([](NDArray **u, real_t *s, NDArray **out,
int num_params, char **param_keys, char **param_vals) {
SampleGaussian(s[0], s[1], out[0]);
})
.set_num_scalars(2)
.set_num_mutate_vars(1);
.set_type_mask(kNDArrayArgBeforeScalar)
.add_argument("src", "NDArray", "Source input")
.add_argument("slice_dim", "int", "the dimension to be sliced")
.add_argument("start", "int", "The starting position to be sliced")
.add_argument("end", "int", "The ending position of the slice");

MXNET_REGISTER_NDARRAY_FUN(clip)
.set_type_mask(kNDArrayArgBeforeScalar | kAcceptEmptyMutateTarget)
Expand Down
4 changes: 3 additions & 1 deletion src/nnvm/legacy_op_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@ void RegisterLegacyNDFunc() {
if (reg->type_mask & kScalarArgBeforeNDArray) continue;
Op& op = ::dmlc::Registry<::nnvm::Op>::Get()->__REGISTER_OR_GET__(reg->name);
if (op.attr_parser != nullptr) continue;
CHECK_LE(reg->num_scalars + reg->num_use_vars, reg->arguments.size());

CHECK_LE(reg->num_scalars + reg->num_use_vars, reg->arguments.size())
<< reg->name;
auto func = reg->body;
op.describe(reg->description);
op.add_arguments(reg->arguments);
Expand Down

0 comments on commit c0a422c

Please sign in to comment.