code: def check_min_max_valid(
      min_val: torch.Tensor, max_val: torch.Tensor
  ) -> bool:
      """Checks if the given minimum and maximum values are valid, meaning that
      they exist and the min value is less than the max value.
      """
      if min_val.numel() == 0 or max_val.numel() == 0:
          warnings.warn(
              "must run observer before calling calculate_qparams. "
              + "Returning default values."
          )
          return False
  
      if min_val.dim() == 0 or max_val.dim() == 0:
          if min_val == float("inf") and max_val == float("-inf"):
              warnings.warn(
                  "must run observer before calling calculate_qparams. "
                  + "Returning default values."
              )
  
              return False
  
          assert (
              min_val <= max_val
          ), f"min {min_val} should be less than max {max_val}"
      else:
          assert torch.all(
              min_val <= max_val
          ), f"min {min_val} should be less than max {max_val}"
  
      return True
  
imports: import functools
  import warnings
  from collections import OrderedDict
  from inspect import getfullargspec, signature
  from typing import Any, Callable, Dict, Optional, Tuple, Union
  import torch
  from torch.ao.quantization.quant_type import QuantType
  from torch.fx import Node
  from torch.nn.utils.parametrize import is_parametrized
label_desc: Use image node_id 20 for calling a global function with example usage: check_min_max_valid(min_val, max_val) and returns: True, False, False