class_docstr: A worker class used in sampling for PEARL.
  
  It stores context and resample belief in the policy every step.
  
  Args:
      seed (int): The seed to use to intialize random number generators.
      max_episode_length(int or float): The maximum length of episodes which
          will be sampled. Can be (floating point) infinity.
      worker_number (int): The number of the worker where this update is
          occurring. This argument is used to set a different seed for each
          worker.
      deterministic (bool): If True, use the mean action returned by the
          stochastic policy instead of sampling from the returned action
          distribution.
      accum_context (bool): If True, update context of the agent.
  
  Attributes:
      agent (Policy or None): The worker's agent.
      env (Environment or None): The worker's environment.
docstr: Take a single time-step in the current episode.
  
  Returns:
      bool: True iff the episode is done, either due to the environment
      indicating termination of due to reaching `max_episode_length`.
code: def step_episode(self):
      """Take a single time-step in the current episode.
  
      Returns:
          bool: True iff the episode is done, either due to the environment
          indicating termination of due to reaching `max_episode_length`.
  
      """
      if self._eps_length < self._max_episode_length:
          a, agent_info = self.agent.get_action(self._prev_obs)
          if self._deterministic:
              a = agent_info["mean"]
          a, agent_info = self.agent.get_action(self._prev_obs)
          es = self.env.step(a)
          self._observations.append(self._prev_obs)
          self._env_steps.append(es)
          for k, v in agent_info.items():
              self._agent_infos[k].append(v)
          self._eps_length += 1
  
          if self._accum_context:
              s = TimeStep.from_env_step(
                  env_step=es,
                  last_observation=self._prev_obs,
                  agent_info=agent_info,
                  episode_info=self._episode_info,
              )
              self.agent.update_context(s)
          if not es.last:
              self._prev_obs = es.observation
              return False
      self._lengths.append(self._eps_length)
      self._last_observations.append(self._prev_obs)
      return True
  
imports: import copy
  import akro
  from dowel import logger
  import numpy
  import torch
  from garage import EnvSpec, InOutSpec, StepType, TimeStep
  from garage.experiment import MetaEvaluator
  from garage.np.algos import MetaRLAlgorithm
  from garage.replay_buffer import PathBuffer
  from garage.sampler import DefaultWorker
  from garage.torch import global_device
  from garage.torch._functions import np_to_torch, zero_optim_grads
  from garage.torch.embeddings import MLPEncoder
  from garage.torch.policies import ContextConditionedPolicy
label_desc: Use image node_id 3 for calling the PEARLWorker obj's underlying member method code with example usage: obj.step_episode() and returns: True, False