class_docstr: Abstract class for a callable data pre-processing transform.
  
  Subclasses must override the ``train`` method (:code:`pass` if
  no training is required) and ``__call__`` method (to implement
  the actual transform).
  
  Subclasses may also support a pseudo inverse transform (possibly using the
  implementation-specific ``self.inversion_state``, which should be set
  in ``__call__``). If an inversion state is not required, override the
  property `requires_inversion_state` to return ``False``.
  
  Due to possible information loss in the forward pass, the inverse transform
  may be not be perfect/proper, and calling `TransformBase.invert` will result
  in a warning. By default, the inverse transform (implemented in
  `TransformBase._invert`) is just the identity.
  
  :ivar inversion_state: Implementation-specific intermediate state that is
      used to compute the inverse transform for a particular time series. Only
      used if `TransformBase.requires_inversion_state` is ``True``. The
      inversion state is destroyed upon calling `TransformBase.invert`,
      unless the option the option ``retain_inversion_state=True`` is
      specified. This is to prevent potential user error.
  
  .. document private members
  .. automethod:: _invert
class_docstr_tok: ["Abstract","class","for","a","callable","data","pre-processing","transform",".","Subclasses","must","override","the","``","train","``","method","(",":","code",":","`","pass","`","if","no","training","is","required",")","and","``","__call__","``","method","(","to","implement","the","actual","transform",")",".","Subclasses","may","also","support","a","pseudo","inverse","transform","(","possibly","using","the","implementation-specific","``","self.inversion_state","``",",","which","should","be","set","in","``","__call__","``",")",".","If","an","inversion","state","is","not","required",",","override","the","property","`","requires_inversion_state","`","to","return","``","False","``",".","Due","to","possible","information","loss","in","the","forward","pass",",","the","inverse","transform","may","be","not","be","perfect\/proper",",","and","calling","`","TransformBase.invert","`","will","result","in","a","warning",".","By","default",",","the","inverse","transform","(","implemented","in","`","TransformBase._invert","`",")","is","just","the","identity",".",":","ivar","inversion_state",":","Implementation-specific","intermediate","state","that","is","used","to","compute","the","inverse","transform","for","a","particular","time","series",".","Only","used","if","`","TransformBase.requires_inversion_state","`","is","``","True","``",".","The","inversion","state","is","destroyed","upon","calling","`","TransformBase.invert","`",",","unless","the","option","the","option","``","retain_inversion_state=True","``","is","specified",".","This","is","to","prevent","potential","user","error",".","..","document","private","members","..","automethod",":",":","_invert"]
docstr: Applies the inverse of this transform on the time series.
  
  :param time_series: The time series on which to apply the inverse
      transform.
  :param retain_inversion_state: If an inversion state is required, supply
      ``retain_inversion_state=True`` to retain the inversion state
      even after calling this method. Otherwise, the inversion state will
      be set to ``None`` after the inversion is applied, to prevent a user
      error of accidentally using a stale state.
  
  :return: The (inverse) transformed time series.
docstr_tok: ["Applies","the","inverse","of","this","transform","on","the","time","series",".",":","param","time_series",":","The","time","series","on","which","to","apply","the","inverse","transform",".",":","param","retain_inversion_state",":","If","an","inversion","state","is","required",",","supply","``","retain_inversion_state=True","``","to","retain","the","inversion","state","even","after","calling","this","method",".","Otherwise",",","the","inversion","state","will","be","set","to","``","None","``","after","the","inversion","is","applied",",","to","prevent","a","user","error","of","accidentally","using","a","stale","state",".",":","return",":","The","(","inverse",")","transformed","time","series","."]
code: def invert(
      self, time_series: TimeSeries, retain_inversion_state=False
  ) -> TimeSeries:
      """
      Applies the inverse of this transform on the time series.
  
      :param time_series: The time series on which to apply the inverse
          transform.
      :param retain_inversion_state: If an inversion state is required, supply
          ``retain_inversion_state=True`` to retain the inversion state
          even after calling this method. Otherwise, the inversion state will
          be set to ``None`` after the inversion is applied, to prevent a user
          error of accidentally using a stale state.
  
      :return: The (inverse) transformed time series.
      """
      if not self.proper_inversion:
          logger.warning(
              f"Transform {self} is not strictly invertible. Calling invert() is not guaranteed to recover the "
              f"original time series exactly!"
          )
  
      if self.requires_inversion_state and self.inversion_state is None:
          raise RuntimeError(
              "Inversion state not set. Please call this transform on an "
              "input time series before calling invert(). If you are trying "
              "to call invert() a second time, please supply the option "
              "`retain_inversion_state=True` to the first call."
          )
  
      inverted = self._invert(time_series)
      if not retain_inversion_state:
          self.inversion_state = None
      return inverted
  
imports: from abc import abstractmethod
  from copy import deepcopy
  from enum import Enum
  import inspect
  import logging
  from merlion.utils import TimeSeries
  from merlion.utils.misc import AutodocABCMeta
label_desc: Use image node_id 11 for calling the TransformBase obj's underlying member method code with example usage: obj.invert(time_series, retain_inversion_state) and returns: inverted