Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simon-lc/nablanet.jl
Differentiable neural network with easy access to Jacobians of the output wrt the input and the network parameters.
https://github.com/simon-lc/nablanet.jl
Last synced: about 1 month ago
JSON representation
Differentiable neural network with easy access to Jacobians of the output wrt the input and the network parameters.
- Host: GitHub
- URL: https://github.com/simon-lc/nablanet.jl
- Owner: simon-lc
- License: mit
- Created: 2022-05-07T07:02:35.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-13T21:25:34.000Z (over 2 years ago)
- Last Synced: 2024-11-11T08:46:05.241Z (about 2 months ago)
- Language: Julia
- Size: 18.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NablaNet.jl
[![CI](https://github.com/simon-lc/NablaNet.jl/actions/workflows/CI.yml/badge.svg)](https://github.com/simon-lc/NablaNet.jl/actions/workflows/CI.yml)
[![codecov](https://codecov.io/gh/simon-lc/NablaNet.jl/branch/main/graph/badge.svg?token=CHJNI2LRNZ)](https://codecov.io/gh/simon-lc/NablaNet.jl)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.## Create a fully connected neural network with nonlinear activations
```
## Dimensions
# input size = 3
ni = 3
# final output size = 4
no = 4
```## Neural Network
```
# 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))
```
## Computations and Gradients
### Evaluate the output of the neural network for given input and parameters
```
evaluation!(net, xi, θ)
get_output(net)
```
### Jacobian of the output with respect ot the input
```
jacobian_input!(net, xi, θ)
net.jacobian_input
```
### Jacobian of the output with respect ot the input
```
jacobian_parameters!(net, xi, θ)
net.jacobian_parameters
```See [this example](../main/examples/net.jl) for more details.