code: def filter_by_bin(self, distances, bins, num_pairs):
      range_max = len(bins) - 1
      all_idx = []
      for i in range(range_max):
          s, e = bins[i], bins[i + 1]
          low_condition = s <= distances
          high_condition = (
              distances < e if i != range_max - 1 else distances <= e
          )
          condition = torch.where(low_condition & high_condition)[0]
          if len(condition) == 0:
              continue
          idx = torch.multinomial(
              torch.ones_like(
                  condition, device=condition.device, dtype=torch.float
              ),
              num_pairs,
              replacement=True,
          )
          all_idx.append(condition[idx])
      return torch.cat(all_idx, dim=0)
  
file_path: pytorch-metric-learning/src/pytorch_metric_learning/miners/uniform_histogram_miner.py
imports: import torch
  from ..utils import loss_and_miner_utils
  from .base_miner import BaseMiner
label_desc: Use image node_id 4 for calling the UniformHistogramMiner obj's underlying member method code with example usage: obj.filter_by_bin(distances, bins, num_pairs) and returns: torch