docstr: Args:
      output: the output of self.mine
  This asserts that the mining function is outputting
  properly formatted indices. The default is to require a tuple representing
  a,p,n indices or a1,p,a2,n indices within a batch of embeddings.
  For example, a tuple of (anchors, positives, negatives) will be
  (torch.tensor, torch.tensor, torch.tensor)
docstr_tok: ["Args",":","output",":","the","output","of","self.mine","This","asserts","that","the","mining","function","is","outputting","properly","formatted","indices",".","The","default","is","to","require","a","tuple","representing","a",",","p",",","n","indices","or","a1",",","p",",","a2",",","n","indices","within","a","batch","of","embeddings",".","For","example",",","a","tuple","of","(","anchors",",","positives",",","negatives",")","will","be","(","torch.tensor",",","torch.tensor",",","torch.tensor",")"]
code: def output_assertion(self, output):
      """
      Args:
          output: the output of self.mine
      This asserts that the mining function is outputting
      properly formatted indices. The default is to require a tuple representing
      a,p,n indices or a1,p,a2,n indices within a batch of embeddings.
      For example, a tuple of (anchors, positives, negatives) will be
      (torch.tensor, torch.tensor, torch.tensor)
      """
      if len(output) == 3:
          self.num_triplets = len(output[0])
          assert self.num_triplets == len(output[1]) == len(output[2])
      elif len(output) == 4:
          self.num_pos_pairs = len(output[0])
          self.num_neg_pairs = len(output[2])
          assert self.num_pos_pairs == len(output[1])
          assert self.num_neg_pairs == len(output[3])
      else:
          raise TypeError
  
file_path: pytorch-metric-learning/src/pytorch_metric_learning/miners/base_miner.py
imports: import torch
  from ..utils import common_functions
  from ..utils.module_with_records_and_reducer import ModuleWithRecordsAndDistance
label_desc: Use image node_id 3 for calling the BaseMiner obj's underlying member method code with example usage: obj.output_assertion(output) without return types