pyml.neural_network.layer.transformation.reshape.Reshape#

class Reshape(input_shape, output_shape)[source]#

Bases: _Transformation

Reshape Layer

Parameters:
  • input_shape (tuple[int]) – The shape of the input data before reshaping.

  • output_shape (tuple[int]) – The desired shape of the output data after reshaping.

Notes

This layer does not have any learnable parameters. It simply reshapes the input data based on the specified input and output shapes.

Methods

__init__

backward

Perform the backward pass of the reshaping operation on the gradient of the output data.

forward

Perform the forward pass of the reshaping operation on the input data.

set_adjacent_layers

Set adjacent layers which are needed for the model to iterate through the layers.

backward(dvalues)[source]#

Perform the backward pass of the reshaping operation on the gradient of the output data.

Return type:

None

Parameters:

dvalues (numpy.ndarray) – Derived gradient from the previous layer (reversed order).

forward(inputs)[source]#

Perform the forward pass of the reshaping operation on the input data.

Return type:

None

Parameters:

inputs (numpy.ndarray) – Input values from previous layer.

set_adjacent_layers(previous_layer, next_layer)#

Set adjacent layers which are needed for the model to iterate through the layers.

Parameters:
  • previous_layer (_Layer) – Layer that is previous to this layer.

  • next_layer (_Layer) – Layer that is subsequent to this layer.