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

Commit

Permalink
doc fix, check fix, whitespace remove
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaiBapchya committed Nov 22, 2018
1 parent ccebcec commit 9a3b7fd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
7 changes: 0 additions & 7 deletions python/mxnet/ndarray/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,13 +557,6 @@ def randint(low, high, shape=_Null, dtype=_Null, ctx=None, out=None, **kwargs):
>>> mx.nd.random.randint(-10, 10, shape=(2,))
[ -5 4]
<NDArray 2 @cpu(0)>
>>> low = mx.nd.array([1,2,3])
>>> high = mx.nd.array([2,3,4])
>>> mx.nd.random.randint(low, high, shape=2)
[[ 1 1]
[ 2 2]
[ 3 3]]
<NDArray 3x2 @cpu(0)>
"""
return _random_helper(_internal._random_randint, None,
[low, high], shape, dtype, ctx, out, kwargs)
6 changes: 3 additions & 3 deletions src/operator/random/sample_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ inline bool SampleOpType(const nnvm::NodeAttrs& attrs,
}
bool dtype_ok = (dtype == kFloat16) || (dtype == kFloat32) ||
(dtype == kFloat64);
CHECK_EQ(dtype_ok, true) << "Output type must be float16, float32, float64: dtype is "
CHECK(dtype_ok) << "Output type must be float16, float32, float64: dtype is "
<< dtype_out << " vs " << kFloat16 << " or " << kFloat32 << " or "
<< kFloat64;
TYPE_ASSIGN_CHECK(*out_type, 0, dtype);
Expand Down Expand Up @@ -782,11 +782,11 @@ inline bool SampleOpType<SampleRandIntParam>(const nnvm::NodeAttrs& attrs,
dtype = param.dtype;
} else {
// Use default
dtype = kFloat32;
dtype = kInt32;
}
}
bool dtype_ok = (dtype == kInt32) || (dtype == kInt64);
CHECK_EQ(dtype_ok, true) << "Output type must be int32, int64: dtype is "
CHECK(dtype_ok) << "Output type must be int32, int64: dtype is "
<< dtype_out << " vs " << kInt32 << " or " << kInt64;
TYPE_ASSIGN_CHECK(*out_type, 0, dtype);
return true;
Expand Down
2 changes: 1 addition & 1 deletion tests/python/unittest/test_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ def test_randint_generator():
for dtype in ['int32', 'int64']:
for low, high in [(50000000, 50001000),(-50000000,-9900),(-500,199),(-2147483647,2147483647)]:
scale = high - low
buckets, probs = gen_buckets_probs_with_ppf(lambda x: ss.uniform.ppf(x, loc=low, scale=scale), 5)
buckets, probs = gen_buckets_probs_with_ppf(lambda x: ss.uniform.ppf(x, loc=low, scale=scale), 5)
# Quantize bucket boundaries to reflect the actual dtype and adjust probs accordingly
buckets = np.array(buckets, dtype=dtype).tolist()
probs = [(buckets[i][1] - buckets[i][0]) / float(scale) for i in range(5)]
Expand Down

0 comments on commit 9a3b7fd

Please sign in to comment.