
"""Metrics observers."""

import abc
from typing import Dict, Union

import dm_env
import numpy as np


Number = Union[int, float]


class EnvLoopObserver(abc.ABC):
  """An interface for collecting metrics/counters in EnvironmentLoop."""

  def observe_first(self, env: dm_env.Environment, timestep: dm_env.TimeStep
                    ) -> None:
    """Observes the initial state."""

  @abc.abstractmethod
  def observe(self, env: dm_env.Environment, timestep: dm_env.TimeStep,
              action: np.ndarray) -> None:
    """Records one environment step."""

  @abc.abstractmethod
  def get_metrics(self) -> Dict[str, Number]:
    """Returns metrics collected for the current episode."""


"""Metrics observers."""

import abc
from typing import Dict, Union

import dm_env
import numpy as np


Number = Union[int, float]


class EnvLoopObserver(abc.ABC):
  """An interface for collecting metrics/counters in EnvironmentLoop."""

  @abc.abstractmethod
  def observe_first(self, env: dm_env.Environment, timestep: dm_env.TimeStep
                    ) -> None:
    """Observes the initial state."""

  @abc.abstractmethod
  def observe(self, env: dm_env.Environment, timestep: dm_env.TimeStep,
              action: np.ndarray) -> None:
    """Records one environment step."""

  @abc.abstractmethod
  def get_metrics(self) -> Dict[str, Number]:
    """Returns metrics collected for the current episode."""

Add a missing @abc.abstractmethod declaration
Add a missing @abc.abstractmethod declaration

PiperOrigin-RevId: 424036906
Change-Id: I3979c35ec30caa4b684d43376b2a36d21f7e79df

  
  """Metrics observers."""
  
  import abc
  from typing import Dict, Union
  
  import dm_env
  import numpy as np
  
  
  Number = Union[int, float]
  
  
  class EnvLoopObserver(abc.ABC):
    """An interface for collecting metrics/counters in EnvironmentLoop."""
  
+   @abc.abstractmethod
    def observe_first(self, env: dm_env.Environment, timestep: dm_env.TimeStep
                      ) -> None:
      """Observes the initial state."""
  
    @abc.abstractmethod
    def observe(self, env: dm_env.Environment, timestep: dm_env.TimeStep,
                action: np.ndarray) -> None:
      """Records one environment step."""
  
    @abc.abstractmethod
    def get_metrics(self) -> Dict[str, Number]:
      """Returns metrics collected for the current episode."""
  
Add a missing @abc.abstractmethod declaration
## Code Before:

"""Metrics observers."""

import abc
from typing import Dict, Union

import dm_env
import numpy as np


Number = Union[int, float]


class EnvLoopObserver(abc.ABC):
  """An interface for collecting metrics/counters in EnvironmentLoop."""

  def observe_first(self, env: dm_env.Environment, timestep: dm_env.TimeStep
                    ) -> None:
    """Observes the initial state."""

  @abc.abstractmethod
  def observe(self, env: dm_env.Environment, timestep: dm_env.TimeStep,
              action: np.ndarray) -> None:
    """Records one environment step."""

  @abc.abstractmethod
  def get_metrics(self) -> Dict[str, Number]:
    """Returns metrics collected for the current episode."""

## Instruction:
Add a missing @abc.abstractmethod declaration
## Code After:

"""Metrics observers."""

import abc
from typing import Dict, Union

import dm_env
import numpy as np


Number = Union[int, float]


class EnvLoopObserver(abc.ABC):
  """An interface for collecting metrics/counters in EnvironmentLoop."""

  @abc.abstractmethod
  def observe_first(self, env: dm_env.Environment, timestep: dm_env.TimeStep
                    ) -> None:
    """Observes the initial state."""

  @abc.abstractmethod
  def observe(self, env: dm_env.Environment, timestep: dm_env.TimeStep,
              action: np.ndarray) -> None:
    """Records one environment step."""

  @abc.abstractmethod
  def get_metrics(self) -> Dict[str, Number]:
    """Returns metrics collected for the current episode."""
