iprog4u

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.

Where Next?

Popular Pragmatic Bookshelf topics Top

jon
Some minor things in the paper edition that says “3 2020” on the title page verso, not mentioned in the book’s errata online: p. 186 But...
New
JohnS
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
leba0495
Hello! Thanks for the great book. I was attempting the Trie (chap 17) exercises and for number 4 the solution provided for the autocorre...
New
brian-m-ops
#book-python-testing-with-pytest-second-edition Hi. Thanks for writing the book. I am just learning so this might just of been an issue ...
New
patoncrispy
I’m new to Rust and am using this book to learn more as well as to feed my interest in game dev. I’ve just finished the flappy dragon exa...
New
New
mert
AWDWR 7, page 152, page 153: Hello everyone, I’m a little bit lost on the hotwire part. I didn’t fully understand it. On page 152 @rub...
New
Henrai
Hi, I’m working on the Chapter 8 of the book. After I add add the point_offset, I’m still able to see acne: In the image above, I re...
New
jwandekoken
Book: Programming Phoenix LiveView, page 142 (157/378), file lib/pento_web/live/product_live/form_component.ex, in the function below: d...
New
andreheijstek
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 Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
New
ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
Exadra37
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
AstonJ
There’s a whole world of custom keycaps out there that I didn’t know existed! Check out all of our Keycaps threads here: https://forum....
New
PragmaticBookshelf
Tailwind CSS is an exciting new CSS framework that allows you to design your site by composing simple utility classes to create complex e...
New
PragmaticBookshelf
Build highly interactive applications without ever leaving Elixir, the way the experts do. Let LiveView take care of performance, scalabi...
New
PragmaticBookshelf
Create efficient, elegant software tests in pytest, Python's most powerful testing framework. Brian Okken @brianokken Edited by Kat...
New
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New
PragmaticBookshelf
Get the comprehensive, insider information you need for Rails 8 with the new edition of this award-winning classic. Sam Ruby @rubys ...
New
NewsBot
Node.js v22.14.0 has been released. Link: Release 2025-02-11, Version 22.14.0 'Jod' (LTS), @aduh95 · nodejs/node · GitHub
New

Sub Categories: