(ctx, input, target)
return torch.clamp(x / 2 - z_k + 0.5, min=0.0)
input (FloatTensor): n x num_classes
        target (LongTensor): n, the indices of the target classes
input (FloatTensor): n x num_classes
        target (LongTensor): n, the indices of the target classes
input ( FloatTensor ) : n x num_classes target ( LongTensor ) : n the indices of the target classes
def forward(ctx, input, target):
        """
        input (FloatTensor): n x num_classes
        target (LongTensor): n, the indices of the target classes
        """
        input_batch, classes = input.size()
        target_batch = target.size(0)
        aeq(input_batch, target_batch)

        z_k = input.gather(1, target.unsqueeze(1)).squeeze()
        tau_z, support_size = threshold_and_support(input, dim=1)
        support = input > tau_z
        x = torch.where(
            support, input**2 - tau_z**2,
            torch.tensor(0.0, device=input.device)
        ).sum(dim=1)
        ctx.save_for_backward(input, target, tau_z)
        # clamping necessary because of numerical errors: loss should be lower
        # bounded by zero, but negative values near zero are possible without
        # the clamp
        return torch.clamp(x / 2 - z_k + 0.5, min=0.0)
def forward ( ctx , input , target ) : input_batch , classes = input . size ( ) target_batch = target . size ( 0 ) aeq ( input_batch , target_batch ) z_k = input . gather ( 1 , target . unsqueeze ( 1 ) ) . squeeze ( ) tau_z , support_size = threshold_and_support ( input , dim = 1 ) support = input > tau_z x = torch . where ( support , input ** 2 - tau_z ** 2 , torch . tensor ( 0.0 , device = input . device ) ) . sum ( dim = 1 ) ctx . save_for_backward ( input , target , tau_z ) # clamping necessary because of numerical errors: loss should be lower # bounded by zero, but negative values near zero are possible without # the clamp return torch . clamp ( x / 2 - z_k + 0.5 , min = 0.0 )