Documentation
¶
Overview ¶
Package layers provide various layers
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConvLayer ¶
type ConvLayer struct { InputSize int InputDepth int NumFilters int KernelSize int OutputSize int Stride int Biases []float32 Kernels [][][][]float32 Input [][][]float32 Output [][][]float32 }
ConvLayer represents a convolutional layer in the CNN
func NewConvLayer ¶
NewConvLayer creates a new ConvLayer object with the specified parameters
func (*ConvLayer) BackPropagate ¶
BackPropagate performs backpropagation through the ConvLayer
func (*ConvLayer) ForwardPropagate ¶
ForwardPropagate performs forward propagation through the ConvLayer
type FullyConnectedLayer ¶
type FullyConnectedLayer struct { InputSize int InputWidth int InputDepth int OutputSize int Weights [][]float32 Biases []float32 Input []float32 Output []float32 }
FullyConnectedLayer represents a fully connected layer in the CNN
func NewFullyConnectedLayer ¶
func NewFullyConnectedLayer(inputWidth, inputDepth, outputSize int) *FullyConnectedLayer
NewFullyConnectedLayer creates a new FullyConnectedLayer object with the specified parameters
func (*FullyConnectedLayer) BackPropagate ¶
func (fcl *FullyConnectedLayer) BackPropagate(matrixError [][][]float32) [][][]float32
BackPropagate performs backpropagation through the FullyConnectedLayer
func (*FullyConnectedLayer) ForwardPropagate ¶
func (fcl *FullyConnectedLayer) ForwardPropagate(matrixInput [][][]float32) [][][]float32
ForwardPropagate performs forward propagation through the FullyConnectedLayer
func (*FullyConnectedLayer) GetOutput ¶
func (fcl *FullyConnectedLayer) GetOutput(index int) float32
GetOutput returns the output value at the specified index
type MaxPoolingLayer ¶
type MaxPoolingLayer struct { InputSize int InputDepth int PoolSize int OutputSize int Stride int Output [][][]float32 HighestIndex [][][][]int // Tuple (x,y,z)[2]int representing the position of the highest value // TODO: WTF PrevError [][][]float32 // Add this line }
MaxPoolingLayer represents a max pooling layer in the CNN
func NewMaxPoolingLayer ¶
func NewMaxPoolingLayer(inputSize, inputDepth, poolSize, stride int) *MaxPoolingLayer
NewMaxPoolingLayer creates a new custom MaxPooling layer. inputSize is the spatial dimensions (width and height) of the input. inputDepth is the number of channels or feature maps in the input data poolSize is the spatial dimensions (width and height) of the pooling window used. stride is the step size or interval at which the pooling window moves over the input. It returns an initialized MaxPoolingLayer object
func (*MaxPoolingLayer) BackPropagate ¶
func (mpl *MaxPoolingLayer) BackPropagate(error [][][]float32) [][][]float32
BackPropagate back propagates the error in a max pooling layer. Takes in the error matrix and returns the previous error matrix
func (*MaxPoolingLayer) ForwardPropagate ¶
func (mpl *MaxPoolingLayer) ForwardPropagate(input [][][]float32) [][][]float32
ForwardPropagate reduces the size of the input by using max pooling
func (*MaxPoolingLayer) GetOutput ¶
func (mpl *MaxPoolingLayer) GetOutput(index int) float32
GetOutput returns the output value at the specified index