Some cupy.random distribution does not support `size=None`
See original GitHub issuesize=None
is different from size=()
.
>>> np.random.uniform([2], [[3]])
array([[2.63150331]])
>>> np.random.uniform([2], [[3]], size=())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "mtrand.pyx", line 1317, in mtrand.RandomState.uniform
File "mtrand.pyx", line 267, in mtrand.cont2_array
ValueError: size is not compatible with inputs
>>>
>>> cupy.random.uniform([2], [[3]])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/kataoka/cupy/cupy/random/distributions.py", line 454, in uniform
return rs.uniform(low, high, size=size, dtype=dtype)
File "/home/kataoka/cupy/cupy/random/generator.py", line 484, in uniform
return RandomState._scale_kernel(low, high, rand)
File "cupy/core/_kernel.pyx", line 532, in cupy.core._kernel.ElementwiseKernel.__call__
out_args = _get_out_args_with_params(
File "cupy/core/_kernel.pyx", line 368, in cupy.core._kernel._get_out_args_with_params
raise ValueError('Out shape is mismatched')
ValueError: Out shape is mismatched
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
cupy.random.Generator — CuPy 11.4.0 documentation
Generator exposes a number of methods for generating random numbers drawn from a variety of probability distributions. · None . · None ,...
Read more >cupy.random.RandomState — CuPy 11.3.0 documentation
Returns an array of samples drawn from the binomial distribution. ... cuSOLVER routine(s) which may yield invalid results if input conditions are not...
Read more >cupy.random.choice — CuPy 11.4.0 documentation
Returns an array of random values from a given 1-D array. Each element of the returned array is independently sampled from a according...
Read more >cupy.random.multinomial — CuPy 11.4.0 documentation
cupy.random.multinomial# ... Returns an array from multinomial distribution. ... It does not support sum(pvals) < 1 case. ... Created using Sphinx 5.0.2.
Read more >cupy.random.random_integers — CuPy 11.3.0 documentation
low (int) – If high is not None , it is the lower bound of the interval. ... size (None or int or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After a little bit of inspection using the following script, the status regarding the broadcasting support when
size=None
. Checked means that the generator supports array broadcasting on its parameters, otherwise not. Manual inspection was done overtriangular
andzipf
, since they have some restrictions on the input values, where it was determined that they support broadcasting.Valid generators
beta
binomial
chisquare
dirichlet
exponential
f
gamma
geometric
gumbel
hypergeometric
laplace
logistic
lognormal
logseries
negative_binomial
noncentral_chisquare
noncentral_f
normal
pareto
poisson
power
rayleigh
standard_gamma
standard_t
triangular
uniform
vonmises
wald
zipf
Potentially invalid or restricted generators
multinomial
→ Both CuPy and NumPy documentation state that it operates over 1D values only.multivariate_normal
→ All arguments need to be 2Drandint
→ CuPy only supports int as parameters forlow
andhigh
, whereas NumPy allows for arrays. https://github.com/cupy/cupy/pull/7051random_integers
→ Deprecated in NumPy, CuPy only supports int ranges, it depends onrandint
. https://github.com/cupy/cupy/pull/7051weibull
→ Does not support array inputI guess not all fixed yet? @asi1024