Skip to content

Complex random numbers not working #2355

@maximilian-gelbrecht

Description

@maximilian-gelbrecht

MWE below. In my project I just split it in real and imag part now.

using Reactant
using Random

rng = Random.Xoshiro(123)

function test_rand_complex(rng, n)
    return rand(rng, Complex{Float32}, n)
end

@jit test_rand_complex(rng, 5)
julia> @jit test_rand_complex(rng, 5)
ERROR: MethodError: no method matching rng_bit_generator(::Type{…}, ::Reactant.TracedRArray{…}, ::Vector{…}; algorithm::String, location::Reactant.MLIR.IR.Location)
The function `rng_bit_generator` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  rng_bit_generator(::Type{Reactant.TracedRNumber{T}}, ::Reactant.TracedRArray{UInt64, 1}, ::Any; kwargs...) where T
   @ Reactant ~/.julia/packages/Reactant/itXRw/src/Ops.jl:1623
  rng_bit_generator(::Type{T}, ::Reactant.TracedRArray{UInt64, 1}, ::Any; minval, maxval, algorithm, location) where T<:AbstractFloat
   @ Reactant ~/.julia/packages/Reactant/itXRw/src/Ops.jl:1571
  rng_bit_generator(::Type{T}, ::Reactant.TracedRArray{UInt64, 1}, ::Any; minval, maxval, algorithm, location) where T<:Integer
   @ Reactant ~/.julia/packages/Reactant/itXRw/src/Ops.jl:1533

Stacktrace:
  [1] internal_overload_rand!
    @ ~/.julia/packages/Reactant/itXRw/src/stdlibs/Random.jl:61
  [2] call_with_reactant(::Reactant.EnsureReturnType{…}, ::typeof(Reactant.TracedRandom.internal_overload_rand!), ::Reactant.ReactantRNG{…}, ::Reactant.TracedRArray{…})
    @ Reactant ~/.julia/packages/Reactant/itXRw/src/utils.jl:1090
  [3] internal_overload_rand
    @ ~/.julia/packages/Reactant/itXRw/src/stdlibs/Random.jl:96
  [4] call_with_reactant(::Reactant.EnsureReturnType{…}, ::typeof(Reactant.TracedRandom.internal_overload_rand), ::Reactant.ReactantRNG{…}, ::Type{…}, ::Tuple{…})
    @ Reactant ~/.julia/packages/Reactant/itXRw/src/utils.jl:1090

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions