class_docstr: ARS learner.
code: def _update_model(self) -> int:
      # Update normalization params.
      real_actor_steps = 0
      normalizer_params = self._training_state.normalizer_params
      for _, value in self._evaluation_state.received_results.items():
          real_actor_steps += value.observation.shape[0] - 1
          normalizer_params = self._normalizer_update_fn(
              normalizer_params, value.observation
          )
  
      # Keep only top directions.
      top_directions = []
      for i in range(self._config.num_directions):
          reward_forward = self._evaluation_state.received_results[
              PerturbationKey(
                  self._training_state.training_iteration, i, False
              )
          ].total_reward
          reward_reverse = self._evaluation_state.received_results[
              PerturbationKey(
                  self._training_state.training_iteration, i, True
              )
          ].total_reward
          top_directions.append(
              (max(reward_forward, reward_reverse), i)
          )
      top_directions.sort()
      top_directions = top_directions[-self._config.top_directions :]
  
      # Compute reward_std.
      reward = []
      for _, i in top_directions:
          reward.append(
              self._evaluation_state.received_results[
                  PerturbationKey(
                      self._training_state.training_iteration, i, False
                  )
              ].total_reward
          )
          reward.append(
              self._evaluation_state.received_results[
                  PerturbationKey(
                      self._training_state.training_iteration, i, True
                  )
              ].total_reward
          )
      reward_std = np.std(reward)
  
      # Compute new policy params.
      policy_params = self._training_state.policy_params
      curr_sum = np.zeros_like(policy_params)
      for _, i in top_directions:
          reward_forward = self._evaluation_state.received_results[
              PerturbationKey(
                  self._training_state.training_iteration, i, False
              )
          ].total_reward
          reward_reverse = self._evaluation_state.received_results[
              PerturbationKey(
                  self._training_state.training_iteration, i, True
              )
          ].total_reward
          curr_sum += self._evaluation_state.noises[i] * (
              reward_forward - reward_reverse
          )
  
      policy_params = (
          policy_params
          + self._config.step_size
          / (self._config.top_directions * reward_std)
          * curr_sum
      )
  
      self._training_state = TrainingState(
          key=self._training_state.key,
          normalizer_params=normalizer_params,
          policy_params=policy_params,
          training_iteration=self._training_state.training_iteration,
      )
      return real_actor_steps
  
imports: import collections
  import threading
  import time
  from typing import Any, Deque, Dict, Iterator, List, NamedTuple, Optional
  import acme
  from acme import specs
  from acme.adders import reverb
  from acme.agents.jax.ars import config
  from acme.agents.jax.ars import networks
  from acme.jax import networks
  from acme.jax import running_statistics
  from acme.jax import utils
  from acme.utils import counting
  from acme.utils import loggers
  import jax
  import numpy
  import reverb
label_desc: Use image node_id 4 for calling the ARSLearner obj's underlying member method code with example usage: obj._update_model() and returns: real_actor_steps