code: def validate_input_scaling(
      train_X: Tensor,
      train_Y: Tensor,
      train_Yvar: Optional[Tensor] = None,
      raise_on_fail: bool = False,
      ignore_X_dims: Optional[List[int]] = None,
  ) -> None:
      r"""Helper function to validate input data to models.
  
      Args:
          train_X: A `n x d` or `batch_shape x n x d` (batch mode) tensor of
              training features.
          train_Y: A `n x m` or `batch_shape x n x m` (batch mode) tensor of
              training observations.
          train_Yvar: A `batch_shape x n x m` or `batch_shape x n x m` (batch mode)
              tensor of observed measurement noise.
          raise_on_fail: If True, raise an error instead of emitting a warning
              (only for normalization/standardization checks, an error is always
              raised if NaN values are present).
          ignore_X_dims: For this subset of dimensions from `{1, ..., d}`, ignore the
              min-max scaling check.
  
      This function is typically called inside the constructor of standard BoTorch
      models. It validates the following:
      (i) none of the inputs contain NaN values
      (ii) the training data (`train_X`) is normalized to the unit cube for all
      dimensions except those in `ignore_X_dims`.
      (iii) the training targets (`train_Y`) are standardized (zero mean, unit var)
      No checks (other than the NaN check) are performed for observed variances
      (`train_Yvar`) at this point.
      """
      if settings.validate_input_scaling.off():
          return
      check_no_nans(train_X)
      check_no_nans(train_Y)
      if train_Yvar is not None:
          check_no_nans(train_Yvar)
          if torch.any(train_Yvar < 0):
              raise InputDataError(
                  "Input data contains negative variances."
              )
      check_min_max_scaling(
          X=train_X,
          raise_on_fail=raise_on_fail,
          ignore_dims=ignore_X_dims,
      )
      check_standardization(Y=train_Y, raise_on_fail=raise_on_fail)
  
imports: from __future__ import annotations
  import warnings
  from contextlib import contextmanager, ExitStack
  from typing import Iterator, List, Optional, Tuple
  import torch
  from botorch import settings
  from botorch.exceptions import InputDataError, InputDataWarning
  from botorch.settings import _Flag
  from gpytorch import settings
  from gpytorch.module import Module
  from torch import Tensor
label_desc: Use image node_id 7 for calling a global function with example usage: validate_input_scaling(train_X, train_Y, train_Yvar, raise_on_fail, ignore_X_dims) without return types