neupy.layers.Elementwise

class neupy.layers.Elementwise[source]

Merge multiple input layers elementwise function and generate single output. Each input to this layer should have exactly the same shape.

Parameters:
merge_function : callable

Callable object that accepts multiple arguments and combine them in one with elementwise operation. Defaults to tensorflow.add.

name : str or None

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

Examples

>>> from neupy import layers
>>>
>>> input_1 = layers.Input(10)
>>> input_2 = layers.Input(10)
>>>
>>> network = [input_1, input_2] > layers.Elementwise()
>>>
>>> network.input_shape
[(10,), (10,)]
>>> network.output_shape
(10,)
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.
merge_function = None[source]
options = {'merge_function': Option(class_name='Elementwise', value=CallableProperty(name="merge_function")), 'name': Option(class_name='BaseLayer', value=Property(name="name"))}[source]
output(*input_values)[source]

Return output base on the input value.

Parameters:
input_value
output_shape[source]
validate(input_shapes)[source]

Validate input shape value before assigning it.

Parameters:
input_shape : tuple with int