Skip to content

Nx.Random.normal fails when using {Torchx.Backend, device: :mps} as reported in #1608 #1651

@VasiliyS

Description

@VasiliyS

Attempt ot use Nx.Random.normal or Nx.Random.uniform with the {Torchx.Backend, device: :mps} set as default fails.

There a locked but open issue #1608 that reported the same issue.

Error:

** (ArgumentError) cannot perform operation across devices cpu and mps
    (torchx 0.10.2) lib/torchx.ex:487: anonymous fn/2 in Torchx.prepare_tensors!/1
    (elixir 1.19.3) lib/enum.ex:1814: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir 1.19.3) lib/enum.ex:1814: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (torchx 0.10.2) lib/torchx.ex:286: Torchx.left_shift/2
    (torchx 0.10.2) lib/torchx/backend.ex:709: Torchx.Backend.left_shift/3
    (nx 0.10.0) lib/nx/defn/evaluator.ex:461: Nx.Defn.Evaluator.eval_apply/4
    (nx 0.10.0) lib/nx/defn/evaluator.ex:274: Nx.Defn.Evaluator.eval/3
    #cell:kqxskh7zrfmayiam:2: (file)

Looks like the exception starts at the call to Nx.Random.split.

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