Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot return map from Axon.nx #545

Closed
jonatanklosko opened this issue Nov 14, 2023 · 0 comments · Fixed by #547
Closed

Cannot return map from Axon.nx #545

jonatanklosko opened this issue Nov 14, 2023 · 0 comments · Fixed by #547

Comments

@jonatanklosko
Copy link
Member

model =
  Axon.input("x")
  |> Axon.nx(fn x -> %{x: x} end)

Axon.predict(model, %{}, %{"x" => Nx.tensor(1)})

Fails with

** (Axon.CompileError) exception found when compiling layer anonymous fn/2 in Axon.nx/3 named nx_0:

    ** (ArgumentError) unable to build tensor expression, expected a tensor or a number, got: %{x: #Nx.Tensor<
        f32
        
        Nx.Defn.Expr
        parameter a:0   s64
        b = as_type a   f32
      >}
        (nx 0.7.0-dev) lib/nx/defn/expr.ex:1333: Nx.Defn.Expr.to_expr/1
    

(pass debug: true to build/compile see where the layer was defined)


Compiling of the model was initiated at:

    (nx 0.7.0-dev) lib/nx/defn/compiler.ex:158: Nx.Defn.Compiler.runtime_fun/3
    (nx 0.7.0-dev) lib/nx/defn/evaluator.ex:82: Nx.Defn.Evaluator.precompile/3
    (nx 0.7.0-dev) lib/nx/defn/evaluator.ex:60: Nx.Defn.Evaluator.__compile__/4
    (nx 0.7.0-dev) lib/nx/defn/evaluator.ex:53: Nx.Defn.Evaluator.__jit__/5
    (nx 0.7.0-dev) lib/nx/defn.ex:433: Nx.Defn.do_jit_apply/3

Regression from 235a030.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant