pyFDN.Loss#

class pyFDN.Loss[source]#

Base class for training losses. Combine with + and scale with *.

__init__()#

Methods

__init__()

check(model)

Preflight against the model it will train, before the first step.

terms()

Flatten into (weight, loss) leaves.

Attributes

name

Short label, used as the key in pyFDN.TrainLog.loss_log.

check(model)[source]#

Preflight against the model it will train, before the first step.

Override to reject or warn about a model this loss cannot be fit on – raising here beats a silently useless optimization run. Most losses place no demands on the model, hence the no-op default.

Return type:

None

property name: str#

Short label, used as the key in pyFDN.TrainLog.loss_log.

terms()[source]#

Flatten into (weight, loss) leaves. The trainer registers these.

Return type:

list[tuple[float, Loss]]