# neon.layers.layer.GeneralizedCost¶

class neon.layers.layer.GeneralizedCost(costfunc, name=None)[source]

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

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

Methods

 __init__(costfunc[, name]) gen_class(pdict) get_cost(inputs, targets) 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) 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)[source]

Compute the cost function over the inputs and targets.

Parameters: inputs (Tensor) – Tensor containing input values to be compared to targets targets (Tensor) – Tensor containing target values. 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. Dictionary format for object information. (dict)
get_errors(inputs, targets)[source]

Compute the derivative of the cost function

Parameters: inputs (Tensor) – Tensor containing input values to be compared to targets targets (Tensor) – Tensor containing target values. Tensor of same shape as the inputs containing their respective deltas.
initialize(in_obj)[source]

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