class_docstr: First sub step gets a regular critic, subsequent sub-steps predict a delta w.r.t. to the previous critic.
  Can be instantiated via the
  :class:`~maze.perception.models.critics.delta_state_critic_composer.DeltaStateCriticComposer`.
class_docstr_tok: ["First","sub","step","gets","a","regular","critic",",","subsequent","sub-steps","predict","a","delta","w.r.t",".","to","the","previous","critic",".","Can","be","instantiated","via","the",":","class",":","`","~maze.perception.models.critics.delta_state_critic_composer.DeltaStateCriticComposer","`","."]
docstr: implementation of :class:`~maze.core.agent.state_critic.StateCritic`
docstr_tok: ["implementation","of",":","class",":","`","~maze.core.agent.state_critic.StateCritic","`"]
code: def predict_values(
      self, critic_input: StateCriticInput
  ) -> StateCriticOutput:
      """implementation of :class:`~maze.core.agent.state_critic.StateCritic`"""
  
      critic_output = StateCriticOutput()
      # predict values for the first state
      key_0 = critic_input[0].actor_id.step_key
      value_0 = self.networks[key_0](critic_input[0].tensor_dict)[
          "value"
      ][..., 0]
      critic_output.append(
          StateCriticStepOutput(
              value_0,
              detached_values=value_0.detach(),
              actor_id=critic_input[0].actor_id,
          )
      )
  
      for step_critic_input in critic_input.substep_inputs[1:]:
          # compute value 2 as delta of value 1
          prev_values = critic_output.detached_values[-1]
          obs = step_critic_input.tensor_dict.copy()
          obs["prev_value"] = prev_values.unsqueeze(-1)
  
          value_delta = self.networks[
              step_critic_input.actor_id.step_key
          ](obs)["value"][..., 0]
          next_values = critic_output.detached_values[-1] + value_delta
  
          critic_output.append(
              StateCriticStepOutput(
                  next_values,
                  detached_values=next_values.detach(),
                  actor_id=step_critic_input.actor_id,
              )
          )
  
      return critic_output
  
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 1 for calling the TorchDeltaStateCritic obj's underlying member method code with example usage: obj.predict_values(critic_input) and returns: critic_output