Skip to content

Commit

Permalink
Allow large array operation in MXNet (dmlc#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
apeforest authored and tqchen committed Jul 31, 2018
1 parent 463c0df commit d68d369
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mshadow/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ const unsigned kRandBufferSize = 1000000;
/*! \brief pi */
const float kPi = 3.1415926f;
/*! \brief type that will be used for index */
typedef unsigned index_t;
typedef int64_t index_t;

#ifdef _WIN32
/*! \brief openmp index for windows */
Expand Down
12 changes: 6 additions & 6 deletions mshadow/tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ struct Shape {
return s;
}
/*! \return number of valid elements */
MSHADOW_XINLINE size_t Size(void) const {
size_t size = this->shape_[0];
MSHADOW_XINLINE index_t Size(void) const {
index_t size = this->shape_[0];
#pragma unroll
for (int i = 1; i < kDimension; ++i) {
size *= this->shape_[i];
Expand Down Expand Up @@ -458,8 +458,8 @@ struct Tensor: public TRValue<Tensor<Device, dimension, DType>,
* \tparam startdim the starting dimension
*/
template<int startdim>
MSHADOW_XINLINE size_t MemSize(void) const {
size_t memsz = this->stride_;
MSHADOW_XINLINE index_t MemSize(void) const {
index_t memsz = this->stride_;
#pragma unroll
for (int i = startdim; i < kSubdim; ++i) {
memsz *= this->shape_[i];
Expand All @@ -476,7 +476,7 @@ struct Tensor: public TRValue<Tensor<Device, dimension, DType>,
/*!
* \return memory cost of the tensor, including the aligned x dimension
*/
MSHADOW_XINLINE size_t MSize(void) const {
MSHADOW_XINLINE index_t MSize(void) const {
return this->MemSize<0>();
}
/*!
Expand Down Expand Up @@ -582,7 +582,7 @@ struct Tensor<Device, 1, DType>:
MSHADOW_XINLINE bool CheckContiguous(void) const {
return true;
}
MSHADOW_XINLINE size_t MSize(void) const {
MSHADOW_XINLINE index_t MSize(void) const {
return shape_[0];
}
MSHADOW_XINLINE index_t size(index_t i) const {
Expand Down

0 comments on commit d68d369

Please sign in to comment.