code: def matching_log_probas(
      embeddings, targets, test_embeddings, num_classes, eps=1e-8
  ):
      """Computes the log-probability of test samples given the training dataset
      for the matching network [1].
  
      Parameters
      ----------
      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)`.
  
      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)`.
  
      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.
  
      Returns
      -------
      log_probas : `torch.Tensor` instance
          A tensor containing the log-probabilities of the test samples given the
          training dataset for the matching network. This tensor has shape
          `(batch_size, num_classes, num_test_samples)`.
  
      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)
      """
      batch_size, num_samples, _ = test_embeddings.shape
      similarities = pairwise_cosine_similarity(
          embeddings, test_embeddings, eps=eps
      )
      logsumexp = torch.logsumexp(similarities, dim=1, keepdim=True)
  
      max_similarities, _ = torch.max(similarities, dim=1, keepdim=True)
      exp_similarities = torch.exp(similarities - max_similarities)
  
      sum_exp = exp_similarities.new_zeros(
          (batch_size, num_classes, num_samples)
      )
      indices = targets.unsqueeze(-1).expand_as(exp_similarities)
      sum_exp.scatter_add_(1, indices, exp_similarities)
  
      return torch.log(sum_exp) + max_similarities - logsumexp
  
imports: import torch
  import torch.nn.functional
label_desc: Use image node_id 2 for calling a global function with example usage: matching_log_probas(embeddings, targets, test_embeddings, num_classes, eps) and returns: unknown