From 3ba2845bb274ddd936e13e2bb4569e57f6ff9360 Mon Sep 17 00:00:00 2001 From: Paul Guyot Date: Tue, 10 Feb 2026 10:09:24 +0100 Subject: [PATCH] Fix Your first Axon model guide 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. --- guides/model_creation/your_first_axon_model.livemd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/model_creation/your_first_axon_model.livemd b/guides/model_creation/your_first_axon_model.livemd index 3afa808f..6546aef0 100644 --- a/guides/model_creation/your_first_axon_model.livemd +++ b/guides/model_creation/your_first_axon_model.livemd @@ -82,7 +82,7 @@ predict_fn.(params :: map(tensor), input :: map(tensor) | tensor) `predict_fn` returns transformed inputs from your model's trainable parameters and the given inputs. ```elixir -params = init_fn.(Nx.template({1, 8}, :f32), %Axon.ModelState{}) +params = init_fn.(Nx.template({1, 8}, :f32), Axon.ModelState.empty()) ```