
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

This test is broken right out of the box…
— FAIL: TestAgent (7.82s)
agent_test.go:77:
Error Trace: agent_test.go:77
agent_test.go:...
New

your book suggests to use Image.toByteData() to convert image to bytes, however I get the following error: "the getter ‘toByteData’ isn’t...
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

Dear Sophie.
I tried to do the “Authorization” exercise and have two questions:
When trying to plug in an email-service, I found the ...
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 completed chapter 6 but am getting the following error when running:
thread 'main' panicked at 'Failed to load texture: IoError(O...
New

On page 78 the following code appears:
<%= link_to ‘Destroy’, product,
class: ‘hover:underline’,
method: :delete,
data: { confirm...
New

The markup used to display the uploaded image results in a Phoenix.LiveView.HTMLTokenizer.ParseError error.
lib/pento_web/live/product_l...
New

Hello faithful readers! If you have tried to follow along in the book, you are asked to start up the dev environment via dx/build and ar...
New

Getting an error when installing the dependencies at the start of this chapter:
could not compile dependency :exla, "mix compile" failed...
New
Other popular topics

Please tell us what is your preferred monitor setup for programming(not gaming) and why you have chosen it.
Does your monitor have eye p...
New

No chair. I have a standing desk.
This post was split into a dedicated thread from our thread about chairs :slight_smile:
New

I am a Linux user since 2012, more or less, and I always use Ubuntu on my computers, and my last 2 laptops have been used Thinkpads, wher...
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

Continuing the discussion from Thinking about learning Crystal, let’s discuss - I was wondering which languages don’t GC - maybe we can c...
New

Hello everyone! This thread is to tell you about what authors from The Pragmatic Bookshelf are writing on Medium.
New

Author Spotlight
Erin Dees
@undees
Welcome to our new author spotlight! We had the pleasure of chatting with Erin Dees, co-author of ...
New

zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig.
General-purpose programming language and toolchain for maintaini...
New

I’m able to do the “artistic” part of game-development; character designing/modeling, music, environment modeling, etc.
However, I don’t...
New

If you’re getting errors like this:
psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /rails
- /js
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /ash
- /vscode
- /opensuse
- /centos
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /react-native
- /textmate
- /sublime-text
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /spring
- /django
- /diversity
- /lua
- /nodejs
- /c
- /slackware
- /julia
- /neovim