class_docstr: An observer has exclusive access to its own environment. Each observer
  captures the state from its environment, and send the state to the agent to
  select an action. Then, the observer applies the action to its environment
  and reports the reward to the agent.
class_docstr_tok: ["An","observer","has","exclusive","access","to","its","own","environment",".","Each","observer","captures","the","state","from","its","environment",",","and","send","the","state","to","the","agent","to","select","an","action",".","Then",",","the","observer","applies","the","action","to","its","environment","and","reports","the","reward","to","the","agent","."]
docstr: Run one episode of n_steps.
  Arguments:
      agent_rref (RRef): an RRef referencing the agent object.
      n_steps (int): number of steps in this episode
docstr_tok: ["Run","one","episode","of","n_steps",".","Arguments",":","agent_rref","(","RRef",")",":","an","RRef","referencing","the","agent","object",".","n_steps","(","int",")",":","number","of","steps","in","this","episode"]
code: def run_episode(self, agent_rref, n_steps):
      r"""
      Run one episode of n_steps.
      Arguments:
          agent_rref (RRef): an RRef referencing the agent object.
          n_steps (int): number of steps in this episode
      """
      state, ep_reward = self.env.reset(), 0
      for step in range(n_steps):
          # send the state to the agent to get an action
          action = _remote_method(
              Agent.select_action, agent_rref, self.id, state
          )
  
          # apply the action to the environment, and get the reward
          state, reward, done, _ = self.env.step(action)
  
          # report the reward to the agent for training purpose
          _remote_method(
              Agent.report_reward, agent_rref, self.id, reward
          )
  
          if done:
              break
  
imports: import numpy
  from itertools import count
  import torch
  import torch.distributed.rpc
  import torch.nn
  import torch.nn.functional
  import torch.optim
  from torch.distributed.rpc import RRef, rpc_sync, rpc_async, remote
  from torch.distributions import Categorical
  from torch.testing._internal.dist_utils import dist_init, worker_name
  from torch.testing._internal.distributed.rpc.rpc_agent_test_fixture import RpcAgentTestFixture
label_desc: Use image node_id 2 for calling the Observer obj's underlying member method code with example usage: obj.run_episode(agent_rref, n_steps) without return types