code: def reduce_mean_ignore_inf(
      x: TensorType, axis: Optional[int] = None
  ) -> TensorType:
      """Same as torch.mean() but ignores -inf values.
  
      Args:
          x: The input tensor to reduce mean over.
          axis: The axis over which to reduce. None for all axes.
  
      Returns:
          The mean reduced inputs, ignoring inf values.
      """
      mask = torch.ne(x, float("-inf"))
      x_zeroed = torch.where(mask, x, torch.zeros_like(x))
      return torch.sum(x_zeroed, axis) / torch.sum(mask.float(), axis)
  
imports: import logging
  import os
  import warnings
  from typing import Dict, List, Optional, TYPE_CHECKING, Union
  import gymnasium
  import numpy
  import tree
  from gymnasium.spaces import Discrete, MultiDiscrete
  from packaging import version
  import ray
  from ray.rllib.models.repeated_values import RepeatedValues
  from ray.rllib.utils.annotations import Deprecated, PublicAPI, DeveloperAPI
  from ray.rllib.utils.framework import try_import_torch
  from ray.rllib.utils.numpy import SMALL_NUMBER
  from ray.rllib.utils.typing import LocalOptimizer, SpaceStruct, TensorStructType, TensorType
label_desc: Use image node_id 16 for calling a global function with example usage: reduce_mean_ignore_inf(x, axis) and returns: unknown