-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multi-input / multi-output models #28
Comments
We currently already support multi input models (just use base = Axon.input({nil, 784}) |> Axon.dense(128)
out1 = base |> Axon.softmax()
out2 = base |> Axon.relu()
model = Axon.tuple([out1, out2]) |
Full support for multi-input models was added in #46. In order to support multi-output models we need to add the tuple(inputs, opts) :: %Axon{op: :tuple, parent: [input1, input2, ...]} This layer will only be supported in other composite layers, as the last layer of the network, or in {x1, x2} = {Axon.input({nil, 32}), Axon.input({nil, 32})}
Axon.tuple([x1, x2])
|> Axon.nx(fn {x1, x2} -> {Nx.cos(x1), Nx.sin(x2)} end) We can by default wrap tuple output shapes in |
I've added support for multi output models: 71fce20 Rather than introducing a new layer, you can pass tuples directly to def model do
inp = Axon.input({nil, 784})
x = Axon.dense(inp, 128)
y = Axon.dense(inp, 10)
{x, y}
end
params = Axon.init(model())
Axon.predict(model(), params, Nx.random_uniform({32, 784})) Currently missing support for multi-output / tuple models in the training API |
No description provided.
The text was updated successfully, but these errors were encountered: