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

Commit

Permalink
formula update and removed itype
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaiBapchya committed Nov 17, 2018
1 parent e7e622c commit 05d696b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions include/mxnet/random_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ class RandGenerator<cpu, DType> {
public:
typedef typename std::conditional<std::is_floating_point<DType>::value,
DType, double>::type FType;
typedef typename std::conditional<std::is_integral<DType>::value,
DType, int>::type IType;
explicit Impl(RandGenerator<cpu, DType> *gen, int state_idx)
: engine_(gen->states_ + state_idx) {}

Expand Down
2 changes: 1 addition & 1 deletion python/mxnet/symbol/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,5 @@ def randint(low, high, shape=_Null, dtype=_Null, **kwargs):
dtype : {'int32', 'int64'}, optional
Data type of output samples. Default is 'int32'
"""
return _random_helper(_internal._random_randint, _internal._sample_uniform,
return _random_helper(_internal._random_randint, None,
[low, high], shape, dtype, kwargs)
4 changes: 2 additions & 2 deletions src/operator/random/sampler.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ struct SampleRandIntKernel {
index_t nBatch(1 + (nSample - 1) / nParm);
if (sizeof(IType) == sizeof(int64_t))
out[i] = OType(lower[i / nBatch] +
(upper[i / nBatch] - lower[i / nBatch]) * genImpl.rand_int64());
genImpl.rand_int64() % (upper[i / nBatch] - lower[i / nBatch]));
else
out[i] = OType(lower[i / nBatch] +
(upper[i / nBatch] - lower[i / nBatch]) * genImpl.rand());
genImpl.rand() % (upper[i / nBatch] - lower[i / nBatch]));
});
}
};
Expand Down

0 comments on commit 05d696b

Please sign in to comment.