Skip to content

Commit d5ecacb

Browse files
authored
Fix Your first Axon model guide (#627)
Fix a crash when evaluating the init_fn cell. The second argument to `init_fn.`, `%Axon.ModelState{}` was a struct with `nil` fields internally, and when `Nx` tried to traverse it as a container, those `nil` atoms failed the `Nx.LazyContainer` protocol.
1 parent 1e8cf61 commit d5ecacb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

guides/model_creation/your_first_axon_model.livemd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ predict_fn.(params :: map(tensor), input :: map(tensor) | tensor)
8282
`predict_fn` returns transformed inputs from your model's trainable parameters and the given inputs.
8383

8484
```elixir
85-
params = init_fn.(Nx.template({1, 8}, :f32), %Axon.ModelState{})
85+
params = init_fn.(Nx.template({1, 8}, :f32), Axon.ModelState.empty())
8686
```
8787

8888
<!-- livebook:{"output":true} -->

0 commit comments

Comments
 (0)