neupy.layers.Reshape

class neupy.layers.Reshape[source]

Reshapes input tensor.

Parameters:
shape : tuple or list

New feature shape. The -1 value means that this value will be computed from the total size that remains. If you need to get the output feature with more that 2 dimensions then you can set up new feature shape using tuples or list. Defaults to [-1].

name : str or None

Layer’s identifier. If name is equal to None than name will be generated automatically. Defaults to None.

Examples

Covert 4D input to 2D

>>> from neupy.layers import *
>>> conn = Input((2, 5, 5)) > Reshape()
>>> conn.input_shape
(2, 5, 5)
>>> conn.output_shape
(50,)

Convert 3D to 4D

>>> from neupy.layers import *
>>> conn = Input((5, 4)) > Reshape((5, 2, 2))
>>> conn.input_shape
(5, 4)
>>> conn.output_shape
(5, 2, 2)
Attributes:
input_shape : tuple

Returns layer’s input shape in the form of a tuple. Shape will not include batch size dimension.

output_shape : tuple

Returns layer’s output shape in the form of a tuple. Shape will not include batch size dimension.

training_state : bool

Defines whether layer in training state or not. Training state will enable some operations inside of the layers that won’t work otherwise.

parameters : dict

Parameters that networks uses during propagation. It might include trainable and non-trainable parameters.

graph : LayerGraph instance

Graphs that stores all relations between layers.

Methods

disable_training_state() Context manager that switches off trainig state.
initialize() Set up important configurations related to the layer.
options = {'name': Option(class_name='BaseLayer', value=Property(name="name")), 'shape': Option(class_name='Reshape', value=NewShapeProperty(name="shape"))}[source]
output(input_value)[source]

Reshape the feature space for the input value.

Parameters:
input_value : array-like or Tensorfow variable
output_shape[source]
shape = None[source]