docstr: Update the target networks.
docstr_tok: ["Update","the","target","networks","."]
code: def update_target_networks(self, num_new_trained_samples) -> None:
      """Update the target networks."""
      self._num_ts_trained_since_last_target_update += (
          num_new_trained_samples
      )
      if (
          self._num_ts_trained_since_last_target_update
          >= self.config.target_network_update_freq
      ):
          self._num_ts_trained_since_last_target_update = 0
          with self._timers[TARGET_NET_UPDATE_TIMER]:
              to_update = (
                  self.workers.local_worker().get_policies_to_train()
              )
              self.workers.local_worker().foreach_policy_to_train(
                  lambda p, pid: pid in to_update and p.update_target()
              )
          self._counters[NUM_TARGET_UPDATES] += 1
          self._counters[LAST_TARGET_UPDATE_TS] = self._counters[
              NUM_AGENT_STEPS_TRAINED
              if self.config.count_steps_by == "agent_steps"
              else NUM_ENV_STEPS_TRAINED
          ]
  
imports: import copy
  import platform
  import random
  from collections import defaultdict
  from typing import Any, Dict, List, Optional, Tuple, Union
  import ray
  from ray._private.dict import merge_dicts
  from ray.actor import ActorHandle
  from ray.rllib.algorithms import Algorithm
  from ray.rllib.algorithms.algorithm_config import AlgorithmConfig, NotProvided
  from ray.rllib.algorithms.dqn.dqn import DQN, DQNConfig
  from ray.rllib.algorithms.dqn.learner_thread import LearnerThread
  from ray.rllib.evaluation.rollout_worker import RolloutWorker
  from ray.rllib.evaluation.worker_set import handle_remote_call_result_errors
  from ray.rllib.utils.actor_manager import FaultTolerantActorManager
  from ray.rllib.utils.actors import create_colocated_actors
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.deprecation import DEPRECATED_VALUE
  from ray.rllib.utils.metrics import LAST_TARGET_UPDATE_TS, NUM_AGENT_STEPS_SAMPLED, NUM_AGENT_STEPS_TRAINED, NUM_ENV_STEPS_SAMPLED, NUM_ENV_STEPS_TRAINED, NUM_TARGET_UPDATES, SAMPLE_TIMER, SYNCH_WORKER_WEIGHTS_TIMER, TARGET_NET_UPDATE_TIMER
  from ray.rllib.utils.typing import PartialAlgorithmConfigDict, ResultDict, SampleBatchType
  from ray.tune.execution.placement_groups import PlacementGroupFactory
  from ray.tune.trainable import Trainable
label_desc: Use image node_id 9 for calling the ApexDQN obj's underlying member method code with example usage: obj.update_target_networks(num_new_trained_samples) without return types