docstr: Push distances and associated targets to the min priority queue,
  popping all the smallest entries to keep the queue below its max size
docstr_tok: ["Push","distances","and","associated","targets","to","the","min","priority","queue",",","popping","all","the","smallest","entries","to","keep","the","queue","below","its","max","size"]
code: def push_all(
      self, similarities: torch.Tensor, targets: torch.Tensor
  ) -> None:
      """
      Push distances and associated targets to the min priority queue,
      popping all the smallest entries to keep the queue below its max size
      """
      assert similarities.shape[0] == targets.shape[0]
  
      if self.similarities is None:
          self.similarities = similarities.cpu()
          self.targets = targets.cpu()
      else:
          self.similarities = torch.cat(
              [self.similarities, similarities.cpu()], dim=1
          )
          self.targets = torch.cat([self.targets, targets.cpu()], dim=1)
  
      if self.similarities.shape[0] > self.max_size:
          self.similarities, indices = self.similarities.topk(
              self.max_size, largest=True, sorted=True
          )
          self.targets = torch.gather(
              self.targets, dim=1, index=indices
          )
          assert self.targets.shape == self.similarities.shape
  
imports: import logging
  from typing import List, NamedTuple
  import numpy
  import torch
  from torch import nn
  from vissl.config import AttrDict
  from vissl.hooks import default_hook_generator
  from vissl.models.model_helpers import get_trunk_output_feature_names
  from vissl.utils.checkpoint import get_checkpoint_folder
  from vissl.utils.distributed_launcher import create_submitit_executor, launch_distributed
  from vissl.utils.env import set_env_vars
  from vissl.utils.extract_features_utils import ExtractedFeaturesLoader
  from vissl.utils.hydra_config import print_cfg
  from vissl.utils.io import save_file
  from vissl.utils.logger import setup_logging, shutdown_logging
label_desc: Use image node_id 2 for calling the MaxSimilarityPriorityQueue obj's underlying member method code with example usage: obj.push_all(similarities, targets) without return types