FunctionSet (deprecated)

class chainer.FunctionSet(**links)[source]

Set of links (as “parameterized functions”).

FunctionSet is a subclass of Chain. Function registration is done just by adding an attribute to object.

Deprecated since version v1.5: Use Chain instead.

Note

FunctionSet was used for manipulation of one or more parameterized functions. The concept of parameterized function is gone, and it has been replaced by Link and Chain.

__getitem__(key)[source]

Returns an attribute by name.

Parameters:key (str) – Name of the attribute.
Returns:Attribute.

Example

>>> import chainer.links as L
>>> model = FunctionSet(l1=L.Linear(10, 10), l2=L.Linear(10, 10))
>>> l1 = model['l1']  # equivalent to l1 = model.l1
collect_parameters()[source]

Returns a tuple of parameters and gradients.

Returns:Tuple (pair) of two tuples. The first element is a tuple of parameter arrays, and the second is a tuple of gradient arrays.
copy_parameters_from(params)[source]

Copies parameters from another source without reallocation.

Parameters:params (Iterable) – Iterable of parameter arrays.
gradients

Tuple of gradient arrays of all registered functions.

The order of gradients is consistent with parameters() property.

parameters

Tuple of parameter arrays of all registered functions.

The order of parameters is consistent with parameters() property.