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
page 20: … protoc command…
I had to additionally run the following go get commands in order to be able to compile protobuf code using go...
New
Following the steps described in Chapter 6 of the book, I’m stuck with running the migration as described on page 84:
bundle exec sequel...
New
Title: Hands-On Rust (Chap 8 (Adding a Heads Up Display)
It looks like
.with_simple_console_no_bg(SCREEN_WIDTH*2, SCREEN_HEIGHT*2...
New
I can’t setup the Rails source code. This happens in a working directory containing multiple (postgres) Rails apps.
With:
ruby-3.0.0
s...
New
Hi! I know not the intentions behind this narrative when called, on page XI:
mount() |> handle_event() |> render()
but the correc...
New
The generated iex result below should list products instead of product for the metadata. (page 67)
iex> product = %Product{}
%Pento....
New
When I run the coverage example to report on missing lines, I get:
pytest --cov=cards --report=term-missing ch7
ERROR: usage: pytest [op...
New
Is the book’s epub format available to read on Google Play Books?
New
Hi, I’ve got a question about the implementation of PubSub when using a Phoenix.Socket.Transport behaviour rather than channels.
Before ...
New
@mfazio23
Android Studio will not accept anything I do when trying to use the Transformations class, as described on pp. 140-141. Googl...
New
Other popular topics
Rust is an exciting new programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters...
New
I have seen the keycaps I want - they are due for a group-buy this week but won’t be delivered until October next year!!! :rofl:
The Ser...
New
Do the test and post your score :nerd_face:
:keyboard:
If possible, please add info such as the keyboard you’re using, the layout (Qw...
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
There appears to have been an update that has changed the terminology for what has previously been known as the Taskbar Overflow - this h...
New
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig.
General-purpose programming language and toolchain for maintaini...
New
Big O Notation can make your code faster by orders of magnitude. Get the hands-on info you need to master data structures and algorithms ...
New
Will Swifties’ war on AI fakes spark a deepfake porn reckoning?
New
Fight complexity and reclaim the original spirit of agility by learning to simplify how you develop software. The result: a more humane a...
New
Ok, well here are some thoughts and opinions on some of the ergonomic keyboards I have, I guess like mini review of each that I use enoug...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /ruby
- /wasm
- /erlang
- /phoenix
- /keyboards
- /python
- /js
- /rails
- /security
- /go
- /swift
- /vim
- /clojure
- /haskell
- /emacs
- /java
- /svelte
- /onivim
- /typescript
- /kotlin
- /c-plus-plus
- /crystal
- /tailwind
- /react
- /gleam
- /ocaml
- /elm
- /flutter
- /vscode
- /ash
- /html
- /opensuse
- /centos
- /php
- /zig
- /deepseek
- /scala
- /sublime-text
- /lisp
- /textmate
- /react-native
- /nixos
- /debian
- /agda
- /kubuntu
- /arch-linux
- /django
- /deno
- /ubuntu
- /revery
- /spring
- /manjaro
- /nodejs
- /diversity
- /lua
- /julia
- /c
- /slackware







