class documentation

A Simple 1D layer

A Dense layer is a simple 1D layer that just has a given number of neurons. Its the most common and basic layer.

Attributes
size: The number of neurons in the layer bias: An array of bias values for a neuron activation: The activation function to apply to this layer output: An array of output values after applying activation function
Method __init__ Constructor for Dense Layer
Method build Overidden Build method
Method compute Method to perform computation on data
Instance Variable activation Activation function used by the layer
Instance Variable activation_str The name of the activation function
Instance Variable bias_array Bias values of the layer
Instance Variable leakyrelu_slope Slope value if using leakyrelu activation function
Instance Variable midway Output value before applying avtivation function
Instance Variable output_array Output matrix of the layer
Instance Variable size Size of the layer

Inherited from BaseLayer:

Instance Variable error_array Error values of the layer
Instance Variable is_built has the layer been built and compiled
Instance Variable name Name of the layer
Instance Variable trainable Is the layer trainable
def __init__(self, size: int, activation: str = None, **kwargs): (source)

Constructor for Dense Layer

Args
size:
The number of neurons in the layer
activation:
The activation function to use for the layer. Available => sigmoid, tanh, relu, leakyrelu
Keyword Args
leakyrelu_slope:
The slope value if leakyrelu is used as the activation function
def build(self): (source)

Overidden Build method

This method initializes the bias and output data array.

def compute(self, input: np.ndarray) -> np.ndarray: (source)

Method to perform computation on data

This method accepts an input vector that is the output vector of the previous layer in the network. Then output values of this layer is calculated.

The input values are simply added with the bias and then passed through the activation function.

Args
input:
The input vector
Returns
The output vector after computaion
activation = (source)

Activation function used by the layer

activation_str = (source)

The name of the activation function

bias_array = (source)

Bias values of the layer

leakyrelu_slope = (source)

Slope value if using leakyrelu activation function

Output value before applying avtivation function

output_array = (source)

Output matrix of the layer

Size of the layer