iprog4u
Machine Learning in Elixir: Chapter 6 Axon.Display.as_table does not work (Page 133)
Please guide me in the right direction. I am able to get .as_graph() to display the model correctly
Axon.Display.as_graph(model, template)
however when I try to run .as_table() I get an error (CAUTION: wall of error text follows):
Axon.Display.as_table(model, template)
|> IO.puts
** (FunctionClauseError) no function clause matching in Axon.Display.do_axon_to_rows/6
The following arguments were given to Axon.Display.do_axon_to_rows/6:
# 1
%Axon.Node{
id: 5,
name: #Function<194.57606554/2 in Axon.name/2>,
mode: :both,
parent: [4],
parameters: [],
args: [:layer],
op: :softmax,
policy: #Axon.MixedPrecision.Policy<>,
hooks: [],
opts: [],
global_options: [],
op_name: :softmax,
meta: %{},
stacktrace: [
{Axon, :layer, 3, [file: ~c"lib/axon.ex", line: 346]},
{:elixir, :eval_external_handler, 3, [file: ~c"src/elixir.erl", line: 388]},
{:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 919]},
{:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 663]},
{:elixir, :eval_forms, 4, [file: ~c"src/elixir.erl", line: 366]},
{Module.ParallelChecker, :verify, 1, [file: ~c"lib/module/parallel_checker.ex", line: 120]}
]
}
# 2
%{
1 => %Axon.Node{
id: 1,
name: #Function<195.57606554/2 in Axon.name/2>,
mode: :both,
parent: [],
parameters: [],
args: [],
op: :input,
policy: #Axon.MixedPrecision.Policy<>,
hooks: [],
opts: [shape: {nil, 748}, optional: false],
global_options: [],
op_name: :input,
meta: nil,
stacktrace: [
{Axon, :layer, 3, [file: ~c"lib/axon.ex", line: 346]},
{:elixir, :eval_external_handler, 3, [file: ~c"src/elixir.erl", line: 388]},
{:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 919]},
{:erl_eval, :expr_list, 7, [file: ~c"erl_eval.erl", line: 1207]},
{:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 625]},
{:erl_eval, :expr_list, 7, [file: ~c"erl_eval.erl", line: 1207]}
]
},
2 => %Axon.Node{
id: 2,
name: #Function<194.57606554/2 in Axon.name/2>,
mode: :both,
parent: [1],
parameters: [
%Axon.Parameter{
name: "kernel",
template: #Function<485.57606554/1 in Axon.shape_fun/2>,
shape: nil,
initializer: #Function<3.47872556/3 in Axon.Initializers.glorot_uniform/1>,
children: nil,
type: {:f, 32},
frozen: false,
kind: :parameter
},
%Axon.Parameter{
name: "bias",
template: #Function<485.57606554/1 in Axon.shape_fun/2>,
shape: nil,
initializer: #Function<23.47872556/2 in Axon.Initializers.zeros/0>,
children: nil,
type: {:f, 32},
frozen: false,
kind: :parameter
}
],
args: [:layer, :parameter, :parameter],
op: :dense,
policy: #Axon.MixedPrecision.Policy<>,
hooks: [],
opts: [],
global_options: [],
op_name: :dense,
meta: %{use_bias: true, units: 128},
stacktrace: [
{Axon, :layer, 3, [file: ~c"lib/axon.ex", line: 346]},
{Axon, :dense, 3, [file: ~c"lib/axon.ex", line: 877]},
{:elixir, :eval_external_handler, 3, [file: ~c"src/elixir.erl", line: 388]},
{:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 919]},
{:erl_eval, :expr_list, 7, [file: ~c"erl_eval.erl", line: 1207]},
{:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 625]}
]
},
3 => %Axon.Node{
id: 3,
name: #Function<194.57606554/2 in Axon.name/2>,
mode: :both,
parent: [2],
parameters: [],
args: [:layer],
op: :relu,
policy: #Axon.MixedPrecision.Policy<>,
hooks: [],
opts: [],
global_options: [],
op_name: :relu,
meta: %{},
stacktrace: [
{Axon, :layer, 3, [file: ~c"lib/axon.ex", line: 346]},
{:elixir, :eval_external_handler, 3, [file: ~c"src/elixir.erl", line: 388]},
{:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 919]},
{:erl_eval, :expr_list, 7, [file: ~c"erl_eval.erl", line: 1207]},
{:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 625]},
{:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 663]}
]
},
4 => %Axon.Node{
id: 4,
name: #Function<194.57606554/2 in Axon.name/2>,
mode: :both,
parent: [3],
parameters: [
%Axon.Parameter{
name: "kernel",
template: #Function<485.57606554/1 in Axon.shape_fun/2>,
shape: nil,
initializer: #Function<3.47872556/3 in Axon.Initializers.glorot_uniform/1>,
children: nil,
type: {:f, 32},
frozen: false,
kind: :parameter
},
%Axon.Parameter{
name: "bias",
template: #Function<485.57606554/1 in Axon.shape_fun/2>,
shape: nil,
initializer: #Function<23.47872556/2 in Axon.Initializers.zeros/0>,
children: nil,
type: {:f, 32},
frozen: false,
kind: :parameter
}
],
args: [:layer, :parameter, :parameter],
op: :dense,
policy: #Axon.MixedPrecision.Policy<>,
hooks: [],
opts: [],
global_options: [],
op_name: :dense,
meta: %{use_bias: true, units: 10},
stacktrace: [
{Axon, :layer, 3, [file: ~c"lib/axon.ex", line: 346]},
{Axon, :dense, 3, [file: ~c"lib/axon.ex", line: 877]},
{:elixir, :eval_external_handler, 3, [file: ~c"src/elixir.erl", line: 388]},
{:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 919]},
{:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 663]},
{:elixir, :eval_forms, 4, [file: ~c"src/elixir.erl", line: 366]}
]
},
5 => %Axon.Node{
id: 5,
name: #Function<194.57606554/2 in Axon.name/2>,
mode: :both,
parent: [4],
parameters: [],
args: [:layer],
op: :softmax,
policy: #Axon.MixedPrecision.Policy<>,
hooks: [],
opts: [],
global_options: [],
op_name: :softmax,
meta: %{},
stacktrace: [
{Axon, :layer, 3, [file: ~c"lib/axon.ex", line: 346]},
{:elixir, :eval_external_handler, 3, [file: ~c"src/elixir.erl", line: 388]},
{:erl_eval, :do_apply, 7, [file: ~c"erl_eval.erl", line: 919]},
{:erl_eval, :expr, 6, [file: ~c"erl_eval.erl", line: 663]},
{:elixir, :eval_forms, 4, [file: ~c"src/elixir.erl", line: 366]},
{Module.ParallelChecker, :verify, 1, [file: ~c"lib/module/parallel_checker.ex", line: 120]}
]
}
}
# 3
#Nx.Tensor<
f32[1][784]
Nx.TemplateBackend
>
# 4
%{}
# 5
%{}
# 6
%{num_params: 0, total_param_byte_size: 0}
Attempted function clauses (showing 2 out of 2):
defp do_axon_to_rows(%Axon.Node{id: id, op: structure, op_name: :container, parent: [parents], name: name_fn}, nodes, templates, cache, op_counts, model_info)
defp do_axon_to_rows(%Axon.Node{
id: id,
parent: parents,
parameters: params,
name: name_fn,
opts: opts,
policy: %{params: {_, bitsize}},
op_name: op_name
}, nodes, templates, cache, op_counts, model_info)
(axon 0.7.0) lib/axon/display.ex:93: Axon.Display.do_axon_to_rows/6
(axon 0.7.0) lib/axon/display.ex:85: Axon.Display.axon_to_rows/6
(axon 0.7.0) lib/axon/display.ex:39: Axon.Display.as_table/2
#cell:r744jk7wwgcawf6v:2: (file)
Perhaps not hyper important as the graph contains the same info but it is nice how the table has the labels.
First Post!
iprog4u
Updating to latest versions does not correct the error.
Mix.install([
{:axon, "~> 0.7.0"},
{:nx, "~> 0.9.2"},
{:exla, "~> 0.9.2"},
{:stb_image, "~> 0.6.10"},
{:kino, "~> 0.17.0"},
{:table_rex, "~> 3.1.1"}
])
Anyone have any ideas what else to try?
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
Hi Jamis,
I think there’s an issue with a test on chapter 6. I own the ebook, version P1.0 Feb. 2019.
This test doesn’t pass for me:
...
New
Hello! On page xix of the preface, it says there is a community forum "… for help if your’re stuck on one of the exercises in this book… ...
New
Hi @venkats,
It has been mentioned in the description of ‘Supervisory Job’ title that 2 things as mentioned below result in the same eff...
New
I ran this command after installing the sample application:
$ cards add do something --owner Brian
And got a file not found error:
Fil...
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
In general, the book isn’t yet updated for Phoenix version 1.6. On page 18 of the book, the authors indicate that an auto generated of ro...
New
It seems the second code snippet is missing the code to set the current_user:
current_user: Accounts.get_user_by_session_token(session["...
New
Skimming ahead, much of the following is explained in Chapter 3, but new readers (like me!) will hit a roadblock in Chapter 2 with their ...
New
root_layout: {PentoWeb.LayoutView, :root},
This results in the following following error:
no “root” html template defined for PentoWeb...
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
I know that -t flag is used along with -i flag for getting an interactive shell. But I cannot digest what the man page for docker run com...
New
Rust is an exciting new programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters...
New
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me.
I think the Planck and the Preonic (o...
New
Biggest jackpot ever apparently! :upside_down_face:
I don’t (usually) gamble/play the lottery, but working on a program to predict the...
New
This is going to be a long an frequently posted thread.
While talking to a friend of mine who has taken data structure and algorithm cou...
New
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol:
bre...
New
Author Spotlight
Dmitry Zinoviev
@aqsaqal
Today we’re putting our spotlight on Dmitry Zinoviev, author of Data Science Essentials in ...
New
Was just curious to see if any were around, found this one:
I got 51/100:
Not sure if it was meant to buy I am sure at times the b...
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
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /ruby
- /wasm
- /erlang
- /phoenix
- /keyboards
- /python
- /js
- /rails
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /java
- /haskell
- /svelte
- /onivim
- /typescript
- /kotlin
- /c-plus-plus
- /crystal
- /tailwind
- /react
- /gleam
- /ocaml
- /flutter
- /elm
- /vscode
- /ash
- /html
- /opensuse
- /zig
- /centos
- /deepseek
- /php
- /scala
- /react-native
- /lisp
- /textmate
- /sublime-text
- /nixos
- /debian
- /agda
- /django
- /kubuntu
- /deno
- /arch-linux
- /nodejs
- /ubuntu
- /revery
- /spring
- /manjaro
- /diversity
- /lua
- /julia
- /markdown
- /slackware








