Layers
Structs and types
NNJulia.Layers.AbstractLayer — TypeAbstractLayerEvery layer is a subtype of this abstract type.
NNJulia.Layers.AbstractModel — TypeAbstractModelEvery trainable model is a subtype of this abstract type.
NNJulia.Layers.Dense — TypeDense(w::Tensor, b::Tensor, f::Function=identity)
Dense(in::Int64, out::Int64, activ::Function=identity)This struct represents a Dense layer (fully connected neurons). To initialise a Dense layer, the simplest way is to use the second constructor by giving the input and output size of the layer.
Fields
- weight: A tensor that contains the weight of the neurones of the layer
- bias: A tensor that contains the biases of the neurons of the layer
- activation: The activation function of the layer
NNJulia.Layers.Sequential — TypeSequential(layers::Vector{T}) where {T<:AbstractLayer}
Sequential(layers::Vararg{T}) where {T<:AbstractLayer}
Sequential()This struct represents a Sequential, a list of sequential layers.
Field
- layers: A list of layers
NNJulia.Layers.Flatten — TypeFlatten()This struct represents a Flatten layer It flatten the input data into a 2 dimentional tensor of shape (n,batchSize) with n = the multiplication of every other dimension's size (except the batchsize) of the original tensor This operation preserve the size of the last dimension.
Methods for layers
NNJulia.Layers.parameters — Functionparameters(d::Dense)Return every trainable tensors of a dense layer (weight and biases)
parameters(s::Sequential)Return an array that contains a reference to every parameters of the layers
parameters(d::Flatten)Does nothing for a flatten layer
NNJulia.Layers.add! — Functionadd!(model::Sequential, layer::AbstractLayer)Add a layer into the list of layers of the sequential