class neupy.layers.Softmax[source]

The layer with the softmax activation function.

size : int or None

Layer input size. None means that layer will not create parameters and will return only activation function output for the specified input value.

weight : array-like, Tensorfow variable, scalar or Initializer

Defines layer’s weights. Default initialization methods you can find here. Defaults to HeNormal().

bias : 1D array-like, Tensorfow variable, scalar, Initializer or None

Defines layer’s bias. Default initialization methods you can find here. Defaults to Constant(0). The None value excludes bias from the calculations and do not add it into parameters list.

name : str or None

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


Feedforward Neural Networks (FNN)

>>> from neupy.layers import *
>>> network = Input(10) > Relu(20) > Softmax(10)

Convolutional Neural Networks (CNN) for Semantic Segmentation

Softmax layer can be used in order to normalize probabilities per pixel. In the example below, we have input 32x32 input image with raw prediction per each pixel for 10 different classes. Softmax normalizes raw predictions per pixel to the probability distribution.

>>> from neupy.layers import *
>>> network = Input((32, 32, 10)) > Softmax()
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.


disable_training_state() Context manager that switches off trainig state.
initialize() Set up important configurations related to the layer.
options = {'bias': Option(class_name='ParameterBasedLayer', value=ParameterProperty(name="bias")), 'name': Option(class_name='BaseLayer', value=Property(name="name")), 'size': Option(class_name='ActivationLayer', value=IntProperty(name="size")), 'weight': Option(class_name='ParameterBasedLayer', value=ParameterProperty(name="weight"))}[source]