Intro to Layers
Layer is encapsulation of a single layer in a neural network
Creating a layer
Layer’s constructor takes an input and output size.
Methods
forward
Forward your layer single step. You can use this function to make predictions
use
You can use it to set which activation function should be used by the Layer while forwarding.
Properties
weights
You can use this property to get or set weights. If you are setting weights make sure you are passing NArray object.
Note: Make sure that new weights are NArray and their shape matches your Layer’s inputSize and outputSize. If layer is of shape (50,10), where inputSize = 50 and outputSize = 10, then weights should be of shape (50,10)
bias
You can use this property to get or set bias. If you are setting weights make sure you are passing NArray object.
Note: Make sure that new bias shape matches your Layer’s outputSize. If layer is of shape (50,10), where inputSize = 50 and outputSize = 10, then bias should be of shape (1,10)
activationFunction
Use it to set activation function for your layer.
use() can be used to perform the same functionality as well.
shape
Returns shape of the Layer as array
name
You can use it to name your layers
References
Some of the functionality is implemented using the awesome resources from the internet.