|
| 1 | +using BFloat16s |
| 2 | + |
| 3 | +if MPS.is_supported(device()) |
| 4 | + |
| 5 | +using .MPSGraphs: MPSGraphRandomOpDescriptor, MPSGraphRandomDistributionNormal, MPSGraphRandomDistributionTruncatedNormal, MPSGraphRandomDistributionUniform |
| 6 | +@testset "MPSGraph random" begin |
| 7 | + # determined by looking at the error message when trying to construct |
| 8 | + # an invalid distribution/type combination |
| 9 | + for (dist, T) in [(MPSGraphRandomDistributionNormal, Float32), |
| 10 | + (MPSGraphRandomDistributionNormal, Float16), |
| 11 | + (MPSGraphRandomDistributionNormal, BFloat16), |
| 12 | + (MPSGraphRandomDistributionTruncatedNormal, Float32), |
| 13 | + (MPSGraphRandomDistributionTruncatedNormal, Float16), |
| 14 | + (MPSGraphRandomDistributionTruncatedNormal, BFloat16), |
| 15 | + (MPSGraphRandomDistributionUniform, Int64), |
| 16 | + (MPSGraphRandomDistributionUniform, Int32), |
| 17 | + (MPSGraphRandomDistributionUniform, Float32), |
| 18 | + (MPSGraphRandomDistributionUniform, Float16), |
| 19 | + (MPSGraphRandomDistributionUniform, BFloat16), |
| 20 | + ] |
| 21 | + @test MPSGraphRandomOpDescriptor(MPSGraphRandomDistributionNormal, Float32) isa MPSGraphRandomOpDescriptor |
| 22 | + end |
| 23 | +end |
| 24 | + |
| 25 | +end # MPS.is_supported(device()) |
0 commit comments