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

Commit

Permalink
disable CHECK; fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
zoeygxy committed Aug 23, 2019
1 parent af79f86 commit 40459bd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 26 deletions.
5 changes: 2 additions & 3 deletions 3rdparty/mshadow/mshadow/extension/slice.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ struct SliceExp : public TRValue<SliceExp<SrcExp,
: src_(src), ch_begin_(begin) {
shape_ = ShapeCheck<srcdim, SrcExp>::Check(src_);
ch_old_ = shape_[dimslice];
CHECK(begin <= shape_[dimslice] && end <= shape_[dimslice])
<< "The slice went out of range. dimslice: " << dimslice << "; shape = "
<< shape_ << "; begin = " << begin << "; end = " << end;
// CHECK(begin <= shape_[dimslice] && end <= shape_[dimslice])
// << "The slice went out of range. "; // TODO(zoeygxy)
shape_[dimslice] = end - begin;
}
template<typename E, int etype>
Expand Down
22 changes: 1 addition & 21 deletions python/mxnet/ndarray/numpy/_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
from ..ndarray import NDArray

__all__ = ['zeros', 'ones', 'add', 'subtract', 'multiply', 'divide', 'mod', 'power', 'tensordot',
'linspace', 'expand_dims', 'tile', 'arange', 'split', 'concatenate', 'stack', 'full',
'slice_assign_scalar', 'slice_assign']
'linspace', 'expand_dims', 'tile', 'arange', 'split', 'concatenate', 'stack', 'full']


@set_module('mxnet.ndarray.numpy')
Expand Down Expand Up @@ -783,22 +782,3 @@ def get_list(arrays):

arrays = get_list(arrays)
return _npi.stack(*arrays, axis=axis, out=out)


@set_module('mxnet.ndarray.numpy')
def slice_assign_scalar(lhs, value, begin, end, step, out=None): # pylint: disable=too-many-arguments
"""
Assign the rhs to a cropped subset of this ndarray in place. Returns the view of this ndarray.
`rhs` and `lhs` should be of the same data type, and on the same device.
The shape of rhs should be the same as the cropped shape of this ndarray.
"""
_npi.slice_assign_scalar(lhs, value, begin=begin, end=end, step=step, out=out)


@set_module('mxnet.ndarray.numpy')
def slice_assign(lhs, rhs, begin, end, step, out=None): # pylint: disable=too-many-arguments
"""
Assign the scalar to a cropped subset of this ndarray. Value will broadcast to the shape of the
cropped shape and will be cast to the same dtype of the ndarray.
"""
return _npi.slice_assign(lhs, rhs, begin=begin, end=end, step=step, out=out)
4 changes: 2 additions & 2 deletions src/c_api/c_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ MXNET_DLL int MXNDArrayReshape64(NDArrayHandle handle,
API_BEGIN();
NDArray *arr = static_cast<NDArray*>(handle);
mxnet::Tuple<dim_t> shape(dims, dims+ndim);
CHECK_GE(arr->shape().Size(), 0) << "Source ndarray's shape is undefined. Input shape: "
<< arr->shape();
// CHECK_GE(arr->shape().Size(), 0) << "Source ndarray's shape is undefined. Input shape: "
// << arr->shape(); // TODO(zoeygxy)
mxnet::TShape new_shape = mxnet::op::InferReshapeShape(shape, arr->shape(), reverse);
*ptr = arr->ReshapeWithRecord(new_shape);
*out = ptr;
Expand Down

0 comments on commit 40459bd

Please sign in to comment.