class_docstr: Transform the observation via an arbitrary function :attr:`f`.
  
  The function :attr:`f` should be defined on the observation space of the base environment, ``env``, and should, ideally, return values in the same space.
  
  If the transformation you wish to apply to observations returns values in a *different* space, you should subclass :class:`ObservationWrapper`, implement the transformation, and set the new observation space accordingly. If you were to use this wrapper instead, the observation space would be set incorrectly.
  
  Example:
      >>> import gym
      >>> import numpy as np
      >>> env = gym.make('CartPole-v1')
      >>> env = TransformObservation(env, lambda obs: obs + 0.1*np.random.randn(*obs.shape))
      >>> env.reset()
      array([-0.08319338,  0.04635121, -0.07394746,  0.20877492])
class_docstr_tok: ["Transform","the","observation","via","an","arbitrary","function",":","attr",":","`","f","`",".","The","function",":","attr",":","`","f","`","should","be","defined","on","the","observation","space","of","the","base","environment",",","``","env","``",",","and","should",",","ideally",",","return","values","in","the","same","space",".","If","the","transformation","you","wish","to","apply","to","observations","returns","values","in","a","*","different","*","space",",","you","should","subclass",":","class",":","`","ObservationWrapper","`",",","implement","the","transformation",",","and","set","the","new","observation","space","accordingly",".","If","you","were","to","use","this","wrapper","instead",",","the","observation","space","would","be","set","incorrectly",".","Example",":",">",">",">","import","gym",">",">",">","import","numpy","as","np",">",">",">","env","=","gym.make","(","'CartPole-v1","'",")",">",">",">","env","=","TransformObservation","(","env",",","lambda","obs",":","obs","+","0.1","*","np.random.randn","(","*","obs.shape",")",")",">",">",">","env.reset","(",")","array","(","[","-0.08319338",",","0.04635121",",","-0.07394746",",","0.20877492","]",")"]
docstr: Transforms the observations with callable :attr:`f`.
  
  Args:
      observation: The observation to transform
  
  Returns:
      The transformed observation
docstr_tok: ["Transforms","the","observations","with","callable",":","attr",":","`","f","`",".","Args",":","observation",":","The","observation","to","transform","Returns",":","The","transformed","observation"]
code: def observation(self, observation):
      """Transforms the observations with callable :attr:`f`.
  
      Args:
          observation: The observation to transform
  
      Returns:
          The transformed observation
      """
      return self.f(observation)
  
imports: from typing import Any, Callable
  import gym
label_desc: Use image node_id 2 for calling the TransformObservation obj's underlying member method code with example usage: obj.observation(observation) and returns: self