File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 359359 rand!(rng, c)
360360 randn!(rng, c)
361361end
362+
363+ @testset " randn NaN (Issue #474)" begin
364+ SEED = 1234
365+ N= 100000000
366+
367+ # randn!
368+ let X = Metal. zeros(Float32, N)
369+ Metal. seed!(SEED)
370+ randn!(X)
371+ nans = findall(isnan, Array(X))
372+ @test isempty(nans)
373+ end
374+
375+ # randn(T, dims::Dims)
376+ let
377+ Metal. seed!(SEED)
378+ X = Metal. randn(Float32, Dims(N))
379+ nans = findall(isnan, Array(X))
380+ @test isempty(nans)
381+ end
382+
383+ # randn(T, dim1::Integer, dims...)
384+ let
385+ Metal. seed!(SEED)
386+ X = Metal. randn(Float32, N)
387+ nans = findall(isnan, Array(X))
388+ @test isempty(nans)
389+ end
390+
391+ # randn(dim1)
392+ let
393+ Metal. seed!(SEED)
394+ X = Metal. randn(N)
395+ nans = findall(isnan, Array(X))
396+ @test isempty(nans)
397+ end
398+ end
You can’t perform that action at this time.
0 commit comments