code: def matching_loss(
      train_embeddings,
      train_targets,
      test_embeddings,
      test_targets,
      num_classes,
      eps=1e-8,
      **kwargs,
  ):
      """Compute the loss (i.e. negative log-likelihood) for the matching network
      on the test/query samples [1].
  
      Parameters
      ----------
      train_embeddings : `torch.Tensor` instance
          A tensor containing the embeddings of the train/support inputs. This
          tensor has shape `(batch_size, num_train_samples, embedding_size)`.
  
      train_targets : `torch.LongTensor` instance
          A tensor containing the targets of the train/support dataset. This tensor
          has shape `(batch_size, num_train_samples)`.
  
      test_embeddings : `torch.Tensor` instance
          A tensor containing the embeddings of the test/query inputs. This tensor
          has shape `(batch_size, num_test_samples, embedding_size)`.
  
      test_targets : `torch.LongTensor` instance
          A tensor containing the targets of the test/query dataset. This tensor
          has shape `(batch_size, num_test_samples)`.
  
      num_classes : int
          Number of classes (i.e. `N` in "N-way classification") in the
          classification task.
  
      eps : float (default: 1e-8)
          Small value to avoid division by zero.
  
      kwargs :
          Additional keyword arguments to be forwarded to the loss function. See
          `torch.nn.functional.cross_entropy` for details.
  
      Returns
      -------
      loss : `torch.Tensor` instance
          A tensor containing the loss for the matching network.
  
      References
      ----------
      .. [1] Vinyals, O., Blundell, C., Lillicrap, T. and Wierstra, D. (2016).
             Matching Networks for One Shot Learning. In Advances in Neural
             Information Processing Systems (pp. 3630-3638) (https://arxiv.org/abs/1606.04080)
      """
      logits = matching_log_probas(
          train_embeddings,
          train_targets,
          test_embeddings,
          num_classes,
          eps=eps,
      )
      return F.nll_loss(logits, test_targets, **kwargs)
  
imports: import torch
  import torch.nn.functional
label_desc: Use image node_id 4 for calling a global function with example usage: matching_loss(train_embeddings, train_targets, test_embeddings, test_targets, num_classes, eps) and returns: F