Skip to content

Commit

Permalink
fix rand & randn (#14)
Browse files Browse the repository at this point in the history
* fix rand & randn
  • Loading branch information
hekaisheng authored and qinxuye committed Dec 10, 2018
1 parent 9b6cf3c commit bf80609
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mars/tensor/expressions/random/rand.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def rand(random_state, *dn, **kw):
[ 0.37601032, 0.25528411], #random
[ 0.49313049, 0.94909878]]) #random
"""
if len(dn) == 1 and isinstance(dn[0], (tuple, list)):
raise TypeError("'tuple' object cannot be interpreted as an integer")
if 'dtype' not in kw:
kw['dtype'] = np.dtype('f8')
chunks = kw.pop('chunks', None)
Expand Down
2 changes: 2 additions & 0 deletions mars/tensor/expressions/random/randn.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ def randn(random_state, *dn, **kw):
array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], #random
[ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) #random
"""
if len(dn) == 1 and isinstance(dn[0], (tuple, list)):
raise TypeError("'tuple' object cannot be interpreted as an integer")
if 'dtype' not in kw:
kw['dtype'] = np.dtype('f8')
chunks = kw.pop('chunks', None)
Expand Down

0 comments on commit bf80609

Please sign in to comment.