LossApply: Selectively apply loss to parameters#

class hypercoil.loss.scheme.LossApply(loss: Callable, apply: Callable = <function unpack_or_noop>)[source]#

Callable loss function wrapper that composes the loss with a selector or other pretransformation.

Parameters:
losscallable

Loss function to apply.

applycallable

Callable that pretransforms the input to the loss. This can be used as a selector, so that different entries in a LossScheme are applied to different combinations of weights, inputs, and outputs. One use case is filtering the inputs to a LossScheme and forwarding only the ones relevant to the loss function at hand.

Attributes:
nu

Methods

__call__(*pparams, key, **params)

Evaluate the loss applied to the output of the apply operation.

apply()

For an argument sequence, unpack if it's a singleton sequence, and otherwise return the sequence.

cfg

get_loss

losses

step