Skip to content

Loss

Methods and Attributes

Bases: Module

Methods:

Name Description
forward
to
Source code in torchebm/core/losses.py
class Loss(nn.Module):
    def __init__(self):
        super().__init__()

    @abstractmethod
    def forward(self, x: torch.Tensor, *args, **kwargs) -> torch.Tensor:
        pass

    def to(self, device):
        self.device = device
        return self

forward abstractmethod

forward(x: Tensor, *args, **kwargs) -> torch.Tensor
Source code in torchebm/core/losses.py
@abstractmethod
def forward(self, x: torch.Tensor, *args, **kwargs) -> torch.Tensor:
    pass

to

to(device)
Source code in torchebm/core/losses.py
def to(self, device):
    self.device = device
    return self