class_docstr: Each sub-step or actor gets its individual critic.
  Can be instantiated via the
  :class:`~maze.perception.models.critics.step_state_critic_composer.StepStateCriticComposer`.
class_docstr_tok: ["Each","sub-step","or","actor","gets","its","individual","critic",".","Can","be","instantiated","via","the",":","class",":","`","~maze.perception.models.critics.step_state_critic_composer.StepStateCriticComposer","`","."]
docstr: Compute returns for each sub-step separately
docstr_tok: ["Compute","returns","for","each","sub-step","separately"]
code: def compute_structured_return(
      self,
      gamma: float,
      gae_lambda: float,
      rewards: List[torch.Tensor],
      values: List[torch.Tensor],
      dones: torch.Tensor,
  ) -> List[torch.Tensor]:
      """Compute returns for each sub-step separately"""
      returns = []
      for substep_rewards, substep_values in zip(rewards, values):
          sub_step_return = self.compute_return(
              gamma=gamma,
              gae_lambda=gae_lambda,
              rewards=substep_rewards,
              values=substep_values,
              dones=dones,
          )
          returns.append(sub_step_return)
  
      return returns
  
imports: from abc import abstractmethod
  from typing import Mapping, Union, List, Dict
  import torch
  from gym import spaces
  from torch import nn
  from maze.core.agent.state_critic import StateCritic
  from maze.core.agent.state_critic_input_output import StateCriticStepOutput, StateCriticOutput, StateCriticInput
  from maze.core.agent.torch_model import TorchModel
  from maze.core.annotations import override
  from maze.core.env.observation_conversion import ObservationType
  from maze.core.env.structured_env import StepKeyType
  from maze.perception.perception_utils import convert_to_torch, flatten_spaces, stack_and_flatten_spaces
label_desc: Use image node_id 3 for calling the TorchStepStateCritic obj's underlying member method code with example usage: obj.compute_structured_return(gamma, gae_lambda, rewards, values, dones) and returns: returns