Skip to content

Commit

Permalink
Add a basic inference mode (elixir-nx#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmor5 authored Oct 7, 2021
1 parent d42cc99 commit 4273e64
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 62 deletions.
6 changes: 5 additions & 1 deletion lib/axon.ex
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ defmodule Axon do
params = Axon.init(model, compiler: EXLA)
Axon.predict(model, params, inputs, compiler: EXLA)
Axon.predict(model, params, inputs, compiler: EXLA, mode: :train)
`Axon.predict/4` by default runs in inference mode, which performs certain
optimizations and removes layers such as dropout layers. If constructing
a training step using `Axon.predict/4`, be sure to specify `mode: :train`.
Both `Axon.init/2` and `Axon.predict/4` can be used from within
Nx defn or outside.
Expand Down
Loading

0 comments on commit 4273e64

Please sign in to comment.