pytagi.nn.base_layer#

Classes#

BaseLayer

Base layer class providing common functionality and properties for neural network layers.

Module Contents#

class pytagi.nn.base_layer.BaseLayer[source]#

Base layer class providing common functionality and properties for neural network layers. This class acts as a Python wrapper for the C++ backend, exposing layer attributes and methods for managing layer information, device placement, and parameters.

Initializes the BaseLayer with a C++ backend instance.

to_cuda()[source]#

Moves the layer’s parameters and computations to the CUDA device.

get_layer_info() str[source]#

Retrieves detailed information about the layer.

Returns:

A string containing the layer’s information.

Return type:

str

get_layer_name() str[source]#

Retrieves the name of the layer.

Returns:

The name of the layer.

Return type:

str

get_max_num_states() int[source]#

Retrieves the maximum number of states the layer can hold.

Returns:

The maximum number of states.

Return type:

int

property input_size: int[source]#

Gets the input size of the layer.

property output_size: int[source]#

Gets the output size of the layer.

property in_width: int[source]#

Gets the input width of the layer (for convolutional layers).

property in_height: int[source]#

Gets the input height of the layer (for convolutional layers).

property in_channels: int[source]#

Gets the input channels of the layer (for convolutional layers).

property out_width: int[source]#

Gets the output width of the layer (for convolutional layers).

property out_height: int[source]#

Gets the output height of the layer (for convolutional layers).

property out_channels: int[source]#

Gets the output channels of the layer (for convolutional layers).

property bias: bool[source]#

Gets a boolean indicating whether the layer has a bias term.

property num_weights: int[source]#

Gets the total number of weights in the layer.

property num_biases: int[source]#

Gets the total number of biases in the layer.

property mu_w: numpy.ndarray[source]#

Gets the mean of the weights (mu_w) as a NumPy array.

property var_w: numpy.ndarray[source]#

Gets the variance of the weights (var_w) as a NumPy array.

property mu_b: numpy.ndarray[source]#

Gets the mean of the biases (mu_b) as a NumPy array.

property var_b: numpy.ndarray[source]#

Gets the variance of the biases (var_b) as a NumPy array.

property delta_mu_w: numpy.ndarray[source]#

Gets the delta mean of the weights (delta_mu_w) as a NumPy array.

property delta_var_w: numpy.ndarray[source]#

Gets the delta variance of the weights (delta_var_w) as a NumPy array. The delta corresponds to the amount of change induced by the update step.

property delta_mu_b: numpy.ndarray[source]#

Gets the delta mean of the biases (delta_mu_b) as a NumPy array. This delta corresponds to the amount of change induced by the update step.

property delta_var_b: numpy.ndarray[source]#

Gets the delta variance of the biases (delta_var_b) as a NumPy array. This delta corresponds to the amount of change induced by the update step.

property num_threads: int[source]#

Gets the number of threads to use for computations.

property training: bool[source]#

Gets a boolean indicating whether the layer is in training mode.

property device: bool[source]#

Gets a boolean indicating whether the layer is on the GPU (‘cuda’) or CPU (‘cpu’).