neon.layers.layer.GeneralizedCostMask

class neon.layers.layer.GeneralizedCostMask(costfunc, weights=1.0, name=None)[source]

Bases: neon.layers.layer.GeneralizedCost

A cost layer that applies the provided cost function and computes errors with respect to inputs and targets. Applies mask to deltas.

Parameters:costfunc (Cost) – class with costfunc that computes errors
__init__(costfunc, weights=1.0, name=None)[source]

Methods

__init__(costfunc[, weights, name])
gen_class(pdict)
get_cost(inputs, targets_mask) Compute the cost function over the inputs and targets.
get_description([skip]) Returns a dict that contains all necessary information needed to serialize this object.
get_errors(inputs, targets_mask) Compute the derivative of the cost function
initialize(in_obj) Determine dimensions of cost and error buffers and allocate space from the input layer
recursive_gen(pdict, key) helper method to check whether the definition
be = None
classnm

Returns the class name.

gen_class(pdict)
get_cost(inputs, targets_mask)[source]

Compute the cost function over the inputs and targets.

Parameters:
  • inputs (Tensor) – Tensor containing input values to be compared to targets
  • targets_mask ((Tensor, Tensor)) – Tuple with Tensor target values and Tensor mask
Returns:

Tensor containing cost

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)
get_errors(inputs, targets_mask)[source]

Compute the derivative of the cost function

Parameters:
  • inputs (Tensor) – Tensor containing input values to be compared to targets
  • targets_mask ((Tensor, Tensor)) – Tuple with Tensor target values and Tensor mask
Returns:

Tensor of same shape as the inputs containing their respective deltas.

initialize(in_obj)

Determine dimensions of cost and error buffers and allocate space from the input layer

Parameters:in_obj (Layer) – input layer from which to calculate costs
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