With NablaNet.jl you can quickly build fully-connected neural networks. NablaNet.jl provides methods for fast and allocation-free evaluations of the neural network for a given input and given parameters. It also provides methods for fast and allocation-free computations of the Jacobians of the output with respect to the input and the network parameters.
## Dimensions
# input size = 3
ni = 3
# final output size = 4
no = 4
# generate a random input and some random parameters
xi = rand(ni)
# create neural network with 4 fully connected layers of sizes 6, 2, 3, no
# the activation functions are tanh, tanh, tanh, and identity for the last layer
net = Net(ni, no, dim_layers=[6,2,3], activations=[x->tanh.(x), x->tanh.(x), x->tanh.(x), x->x])
# generate a random input and some random parameters
θ = rand(NablaNet.parameter_dimension(net))
evaluation!(net, xi, θ)
get_output(net)
jacobian_input!(net, xi, θ)
net.jacobian_input
jacobian_parameters!(net, xi, θ)
net.jacobian_parameters
See this example for more details.