example.fashionMNIST.losses package

Submodules

example.fashionMNIST.losses.loss module

File where to put our custom losses.

class RelativeL1(eps=0.01, reduction='mean')

Comparing to the regular L1, introducing the division by |c| + epsilon (where epsilon = 0.01, to prevent values of 0 in the denominator).

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(input, target)

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class RelativeL2(eps=0.01, reduction='mean')

Idem but for MSE.

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(input, target)

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

loss_name_to_class(loss_name)

Build the right loss class in function of the given name.

Parameters:

loss_name (str.) – Name of the loss used inside the calling context.

Returns:

The matching loss class.

Return type:

nn.Module.