
baskint
Machine Learning in Elixir:294 Axon.Loop.log/4 is undefined or private. Did you mean: * log/2 * log/3
On Page 294, cannot run the training loop. I think the Axon.Loop.handle signature has changed. Getting this error:
step_fn
|> Axon.Loop.loop(init_fn)
|> Axon.Loop.handle(:epoch_completed, &GAN.display_sample(&1, generator_fn))
|> Axon.Loop.log(:iteration_completed, fn
%Axon.Loop.State{epoch: epoch, iteration: iter, step_state: state} ->
d_loss = state[:loss]["discriminator"]
g_loss = state[:loss]["generator"]
"\rEpoch: #{epoch}, batch: #{iter},"
<> " d_loss: #{Nx.to_number(d_loss)},"
<> " g_loss: #{Nx.to_number(g_loss)}"
end, :stdio)
|> Axon.Loop.run(train_data, %{}, compiler: EXLA, epochs: 10)
and even changed to this:
Axon.Loop.handle_event(:epoch_completed, &GAN.display_sample(&1, generator_fn))
Here is the error I am seeing:
** (UndefinedFunctionError) function Axon.Loop.log/4 is undefined or private. Did you mean:
* log/2
* log/3
(axon 0.6.0) Axon.Loop.log(#Axon.Loop<metrics: %{}, handlers: %{started: [], halted: [], completed: [], epoch_started: [], iteration_started: [], iteration_completed: [], epoch_completed: [{#Function<42.105768164/1 in :erl_eval.expr/6>, #Function<6.115020529/2 in Axon.Loop.build_filter_fn/1>}], epoch_halted: []}, ...>, :iteration_completed, #Function<42.105768164/1 in :erl_eval.expr/6>, :stdio)
#cell:yoevooqxcl5jdmoy:12: (file)
Marked As Solved

seanmor5
Author of Genetic Algorithms in Elixir
Thanks for pointing out. The correct function is:
|> Axon.Loop.log(fn
%Axon.Loop.State{epoch: epoch, iteration: iter, step_state: state} ->
d_loss = state[:loss]["discriminator"]
g_loss = state[:loss]["generator"]
"\rEpoch: #{epoch}, batch: #{iter},"
<> " d_loss: #{Nx.to_number(d_loss)},"
<> " g_loss: #{Nx.to_number(g_loss)}"
end, event: :iteration_completed, device: :stdio)
1
Popular Pragmatic Bookshelf topics

Title: Design and Build Great Web APIs - typo “https://company-atk.herokuapp.com/2258ie4t68jv” (page 19, third bullet in URL list)
Typo:...
New

Hi everyone!
There is an error on the page 71 in the book “Programming machine learning from coding to depp learning” P. Perrotta. You c...
New

The book has the same “Problem space/Solution space” diagram on page 18 as is on page 17. The correct Problem/Solution space diagrams ar...
New

This is as much a suggestion as a question, as a note for others.
Locally the SGP30 wasn’t available, so I ordered a SGP40. On page 53, ...
New

Hi, I have just acquired Michael Fazio’s “Kotlin and Android Development” to learn about game programming for Android. I have a game in p...
New

I’m not quite sure what’s going on here, but I’m unable to have to containers successfully complete the Readiness/Liveness checks. I’m im...
New

When installing Cards as an editable package, I get the following error:
ERROR: File “setup.py” not found. Directory cannot be installe...
New

Hi,
I am getting an error I cannot figure out on my test.
I have what I think is the exact code from the book, other than I changed “us...
New

Hi, I need some help, I’m new to rust and was learning through your book. but I got stuck at the last stage of distribution. Whenever I t...
New

Modern front-end development for Rails, second edition - Struggling to get the first chapter to work
After running /bin/setup, the first error was: The foreman' command exists in these Ruby versions: That was easy to fix: gem install fore...
New
Other popular topics

What chair do you have while working… and why?
Is there a ‘best’ type of chair or working position for developers?
New

Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face:
https://on...
New
New

This looks like a stunning keycap set :orange_heart:
A LEGENDARY KEYBOARD LIVES ON
When you bought an Apple Macintosh computer in the e...
New

Hello content creators! Happy new year. What tech topics do you think will be the focus of 2021? My vote for one topic is ethics in tech...
New

Small essay with thoughts on macOS vs. Linux:
I know @Exadra37 is just waiting around the corner to scream at me “I TOLD YOU SO!!!” but I...
New

Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
New

Author Spotlight
Mike Riley
@mriley
This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New

Author Spotlight:
Tammy Coron
@Paradox927
Gaming, and writing games in particular, is about passion, vision, experience, and immersio...
New

Hello,
I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /rails
- /js
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /java
- /haskell
- /onivim
- /svelte
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /ash
- /opensuse
- /centos
- /php
- /deepseek
- /html
- /scala
- /zig
- /textmate
- /debian
- /sublime-text
- /nixos
- /lisp
- /agda
- /react-native
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /spring
- /manjaro
- /django
- /diversity
- /nodejs
- /lua
- /c
- /slackware
- /julia
- /neovim