code: def filter_scores_(
      scores: torch.FloatTensor,
      filter_batch: torch.LongTensor,
  ) -> torch.FloatTensor:
      """Filter scores by setting true scores to NaN.
  
      :param scores: shape: (batch_size, num_entities)
          The scores for all corrupted triples (including the currently considered true triple). Are modified *in-place*.
      :param filter_batch: (m, 2)
          The indices of all positives.
  
      :return:
          A reference to the scores, which have been updated in-place.
      """
      # Bind shape
      batch_size, num_entities = scores.shape
  
      # Set all filtered triples to NaN to ensure their exclusion in subsequent calculations
      scores[filter_batch[:, 0], filter_batch[:, 1]] = float("nan")
  
      # Warn if all entities will be filtered
      # (scores != scores) yields true for all NaN instances (IEEE 754), thus allowing to count the filtered triples.
      if ((scores != scores).sum(dim=1) == num_entities).any():
          logger.warning(
              "User selected filtered metric computation, but all corrupted triples exists also as positive "
              "triples",
          )
  
      return scores
  
imports: from __future__ import annotations
  import logging
  import timeit
  import warnings
  from abc import ABC, abstractmethod
  from collections import ChainMap
  from typing import Any, ClassVar, Collection, Generic, List, Mapping, NamedTuple, Optional, Tuple, Type, TypeVar, Union, cast
  import pandas
  import torch
  from torch_max_mem import maximize_memory_utilization
  from tqdm.autonotebook import tqdm
  from ..constants import COLUMN_LABELS, TARGET_TO_INDEX, TARGET_TO_KEY_LABELS
  from ..metrics.utils import Metric
  from ..models import Model
  from ..triples.triples_factory import restrict_triples
  from ..triples.utils import get_entities, get_relations
  from ..typing import LABEL_HEAD, LABEL_RELATION, LABEL_TAIL, InductiveMode, MappedTriples, Target
  from ..utils import flatten_dictionary, format_relative_comparison, normalize_string, prepare_filter_triples
label_desc: Use image node_id 5 for calling a global function with example usage: filter_scores_(scores, filter_batch) and returns: scores