neon.transforms.activation.Logistic

class neon.transforms.activation.Logistic(name=None, shortcut=False)[source]

Bases: neon.transforms.transform.Transform

Logistic sigmoid activation function, \(f(x) = 1 / (1 + \exp(-x))\)

Squashes the input from range \([-\infty,+\infty]\) to \([0, 1]\)

__init__(name=None, shortcut=False)[source]

Initialize Logistic based on whether shortcut is True or False. Shortcut should be set to true when Logistic is used in conjunction with a CrossEntropy cost. Doing so allows a shortcut calculation to be used during backpropagation.

Parameters:shortcut (bool) – If True, shortcut calculation will be used during backpropagation.

Methods

__init__([name, shortcut]) Initialize Logistic based on whether shortcut is True or False.
bprop(y) Returns the derivative of the logistic (sigmoid) function at y (output)
gen_class(pdict)
get_description([skip]) Returns a dict that contains all necessary information needed to serialize this object.
recursive_gen(pdict, key) helper method to check whether the definition
set_shortcut(shortcut) Sets the backpropagation to use the shortcut when gradients do not need to be calculated.
be = None
bprop(y)[source]

Returns the derivative of the logistic (sigmoid) function at y (output)

Parameters:y (Tensor or OpTree) – input. y = f(x)
Returns:
Derivative of the Logistic (sigmoid)
Returns 1 if shortcut is True. Returns derivative (y*(1-y)) if shortcut is False.
Return type:OpTree
classnm

Returns the class name.

gen_class(pdict)
get_description(skip=[], **kwargs)

Returns a dict that contains all necessary information needed to serialize this object.

Parameters:skip (list) – Objects to omit from the dictionary.
Returns:Dictionary format for object information.
Return type:(dict)
modulenm

Returns the full module path.

recursive_gen(pdict, key)

helper method to check whether the definition dictionary is defining a NervanaObject child, if so it will instantiate that object and replace the dictionary element with an instance of that object

set_shortcut(shortcut)[source]

Sets the backpropagation to use the shortcut when gradients do not need to be calculated.

If True, a shortcut calculation is used. If False, the actual derivative is return during backpropagation.

Parameters:shortcut (bool) – If True, shortcut calculation will be used during backpropagation.