class_docstr: Wrapper for gym CartPole environment where reward is accumulated to the end.
class_docstr_tok: ["Wrapper","for","gym","CartPole","environment","where","reward","is","accumulated","to","the","end","."]
code: def set_state(self, state):
      self.running_reward = state[1]
      self.env = deepcopy(state[0])
      obs = np.array(list(self.env.unwrapped.state))
      return {
          "obs": obs,
          "action_mask": np.array([1, 1], dtype=np.int8),
      }
  
file_path: ray/python/ray/rllib/examples/env/cartpole_sparse_rewards.py
imports: from copy import deepcopy
  import gymnasium
  import numpy
  from gymnasium.spaces import Box, Dict, Discrete
label_desc: Use image node_id 4 for calling the CartPoleSparseRewards obj's underlying member method code with example usage: obj.set_state(state) and returns: dict