text: import torch
  import torch.nn as nn
  
  from ..registry import LOSSES
  
  
  @LOSSES.register_module()
  class CELoss(nn.Module):
      """ Cross Entorpy Loss Wrapper
  
      Args:
          loss_weight (float): Weight of the loss. Default: 1.0.
      """
  
      def __init__(self, loss_weight=1.):
          super().__init__()
          self.loss_weight = loss_weight
          self.criterion = nn.CrossEntropyLoss()
  
      def forward(self, output, target):
          """Forward function."""
          return self.loss_weight * self.criterion(output, target)
  
  
  @LOSSES.register_module()
  class AttrCELoss(nn.Module):
      """ Cross Entorpy Loss Wrapper
  
      Args:
          loss_weight (float): Weight of the loss. Default: 1.0.
      """
  
      def __init__(self, loss_weight=1., weight_attr_neg=0.1, weight_attr_pos=1.):
          super().__init__()
          self.loss_weight = loss_weight
          self.weight_attr_pos = weight_attr_pos
          self.weight_attr_neg = weight_attr_neg
          self.criterion = nn.CrossEntropyLoss(torch.tensor([weight_attr_neg, weight_attr_pos]))
  
      def forward(self, output, target):
          """Forward function."""
          return self.loss_weight * self.criterion(output, target)
  