mypackage.MyModule.loss

MyModule.loss(tensors, inference_outputs, generative_outputs, kl_weight=1.0)[source]

Compute the loss for a minibatch of data.

This function uses the outputs of the inference and generative functions to compute a loss. This many optionally include other penalty terms, which should be computed here.

This function should return an object of type LossRecorder.