class_docstr: Standardize outcomes (zero mean, unit variance).
  
  This module is stateful: If in train mode, calling forward updates the
  module state (i.e. the mean/std normalizing constants). If in eval mode,
  calling forward simply applies the standardization using the current module
  state.
docstr: Standardize outcomes.
  
  If the module is in train mode, this updates the module state (i.e. the
  mean/std normalizing constants). If the module is in eval mode, simply
  applies the normalization using the module state.
  
  Args:
      Y: A `batch_shape x n x m`-dim tensor of training targets.
      Yvar: A `batch_shape x n x m`-dim tensor of observation noises
          associated with the training targets (if applicable).
  
  Returns:
      A two-tuple with the transformed outcomes:
  
      - The transformed outcome observations.
      - The transformed observation noise (if applicable).
docstr_tok: ["Standardize","outcomes",".","If","the","module","is","in","train","mode",",","this","updates","the","module","state","(","i.e",".","the","mean\/std","normalizing","constants",")",".","If","the","module","is","in","eval","mode",",","simply","applies","the","normalization","using","the","module","state",".","Args",":","Y",":","A","`","batch_shape","x","n","x","m","`","-dim","tensor","of","training","targets",".","Yvar",":","A","`","batch_shape","x","n","x","m","`","-dim","tensor","of","observation","noises","associated","with","the","training","targets","(","if","applicable",")",".","Returns",":","A","two-tuple","with","the","transformed","outcomes",":","-","The","transformed","outcome","observations",".","-","The","transformed","observation","noise","(","if","applicable",")","."]
code: def forward(
      self, Y: Tensor, Yvar: Optional[Tensor] = None
  ) -> Tuple[Tensor, Optional[Tensor]]:
      r"""Standardize outcomes.
  
      If the module is in train mode, this updates the module state (i.e. the
      mean/std normalizing constants). If the module is in eval mode, simply
      applies the normalization using the module state.
  
      Args:
          Y: A `batch_shape x n x m`-dim tensor of training targets.
          Yvar: A `batch_shape x n x m`-dim tensor of observation noises
              associated with the training targets (if applicable).
  
      Returns:
          A two-tuple with the transformed outcomes:
  
          - The transformed outcome observations.
          - The transformed observation noise (if applicable).
      """
      if self.training:
          if Y.shape[:-2] != self._batch_shape:
              raise RuntimeError(
                  f"Expected Y.shape[:-2] to be {self._batch_shape}, matching "
                  "the `batch_shape` argument to `Standardize`, but got "
                  f"Y.shape[:-2]={Y.shape[:-2]}."
              )
          if Y.size(-1) != self._m:
              raise RuntimeError(
                  f"Wrong output dimension. Y.size(-1) is {Y.size(-1)}; expected "
                  f"{self._m}."
              )
          stdvs = Y.std(dim=-2, keepdim=True)
          stdvs = stdvs.where(
              stdvs >= self._min_stdv, torch.full_like(stdvs, 1.0)
          )
          means = Y.mean(dim=-2, keepdim=True)
          if self._outputs is not None:
              unused = [
                  i for i in range(self._m) if i not in self._outputs
              ]
              means[..., unused] = 0.0
              stdvs[..., unused] = 1.0
          self.means = means
          self.stdvs = stdvs
          self._stdvs_sq = stdvs.pow(2)
          self._is_trained = torch.tensor(True)
  
      Y_tf = (Y - self.means) / self.stdvs
      Yvar_tf = Yvar / self._stdvs_sq if Yvar is not None else None
      return Y_tf, Yvar_tf
  
imports: from __future__ import annotations
  import warnings
  from abc import ABC, abstractmethod
  from collections import OrderedDict
  from typing import Any, List, Mapping, Optional, Tuple, Union
  import torch
  from botorch.models.transforms.utils import norm_to_lognorm_mean, norm_to_lognorm_variance
  from botorch.posteriors import GPyTorchPosterior, Posterior, TransformedPosterior
  from botorch.utils.transforms import normalize_indices
  from linear_operator.operators import CholLinearOperator, DiagLinearOperator
  from torch import Tensor
  from torch.nn import Module, ModuleDict
label_desc: Use image node_id 3 for calling the Standardize obj's underlying member method code with example usage: obj.forward(Y, Yvar) and returns: Y_tf,  Yvar_tf