class_docstr: Calculate weighted loss of scores for positive and negative pairs.
  
  The inputs are a 1-D tensor of size P containing scores for positive pairs
  of entities (i.e., those among which an edge exists) and a P x N tensor
  containing scores for negative pairs (i.e., where no edge should exist). The
  pairs of entities corresponding to pos_scores[i] and to neg_scores[i,j] have
  at least one endpoint in common. The output is the loss value these scores
  induce. If the method supports weighting (as is the case for the logistic
  loss) all positive scores will be weighted by the same weight and so will
  all the negative ones.
code: def __init__(self, **kwargs):
      # loss functions will default ignore any kwargs, but can ask for any
      # specific kwargs of interest in their constructor
      # FIXME: This is not ideal. Perhaps we should pass in the config
      # or a subconfig instead?
      super().__init__()
  
imports: from abc import ABC, abstractmethod
  from typing import Optional
  import torch
  from torch import nn
  from torch.nn import functional
  from torchbiggraph.model import match_shape
  from torchbiggraph.plugin import PluginRegistry
  from torchbiggraph.types import FloatTensorType
label_desc: Use image node_id 1 to create a new AbstractLossFunction object from inherited base classes: nn, ABC with example: obj = AbstractLossFunction()