docstr: Given a batch of inputs (e.g. states) and targets (e.g. discounted rewards), takes a training step: i.e. runs a
  forward pass and backward pass of the network, accumulates the gradients and applies an optimization step to
  update the weights.
  Calls `accumulate_gradients` followed by `apply_and_reset_gradients`.
  Note: Currently an unused method.
  
  :param inputs: typically the environment states (but can also contain other data necessary for loss).
      (e.g. `{'observation': numpy.ndarray}` with `observation` of shape (batch_size, observation_space_size) or
      (batch_size, observation_space_size, stack_size) or
      `{'observation': numpy.ndarray, 'output_0_0': numpy.ndarray}` with `output_0_0` of shape (batch_size,))
  :param targets: target values of shape (batch_size, ). For example discounted rewards for value network
      for calculating the value-network loss would be a target. Length of list and order of arrays in
      the list matches that of network losses which are defined by network parameters
  :param scaler: value to scale gradients by before optimizing network weights
  :param additional_fetches: list of additional values to fetch and return. The type of each list
      element is framework dependent.
  :param importance_weights: ndarray of shape (batch_size,) to multiply with batch loss.
  :return: tuple of total_loss, losses, norm_unclipped_grads, fetched_tensors
      total_loss (float): sum of all head losses
      losses (list of float): list of all losses. The order is list of target losses followed by list
          of regularization losses. The specifics of losses is dependant on the network parameters
          (number of heads, etc.)
      norm_unclippsed_grads (float): global norm of all gradients before any gradient clipping is applied
      fetched_tensors: all values for additional_fetches
docstr_tok: ["Given","a","batch","of","inputs","(","e.g",".","states",")","and","targets","(","e.g",".","discounted","rewards",")",",","takes","a","training","step",":","i.e",".","runs","a","forward","pass","and","backward","pass","of","the","network",",","accumulates","the","gradients","and","applies","an","optimization","step","to","update","the","weights",".","Calls","`","accumulate_gradients","`","followed","by","`","apply_and_reset_gradients","`",".","Note",":","Currently","an","unused","method",".",":","param","inputs",":","typically","the","environment","states","(","but","can","also","contain","other","data","necessary","for","loss",")",".","(","e.g",".","`","{","'observation","'",":","numpy.ndarray","}","`","with","`","observation","`","of","shape","(","batch_size",",","observation_space_size",")","or","(","batch_size",",","observation_space_size",",","stack_size",")","or","`","{","'observation","'",":","numpy.ndarray",",","'output_0_0","'",":","numpy.ndarray","}","`","with","`","output_0_0","`","of","shape","(","batch_size",",",")",")",":","param","targets",":","target","values","of","shape","(","batch_size",",",")",".","For","example","discounted","rewards","for","value","network","for","calculating","the","value-network","loss","would","be","a","target",".","Length","of","list","and","order","of","arrays","in","the","list","matches","that","of","network","losses","which","are","defined","by","network","parameters",":","param","scaler",":","value","to","scale","gradients","by","before","optimizing","network","weights",":","param","additional_fetches",":","list","of","additional","values","to","fetch","and","return",".","The","type","of","each","list","element","is","framework","dependent",".",":","param","importance_weights",":","ndarray","of","shape","(","batch_size",",",")","to","multiply","with","batch","loss",".",":","return",":","tuple","of","total_loss",",","losses",",","norm_unclipped_grads",",","fetched_tensors","total_loss","(","float",")",":","sum","of","all","head","losses","losses","(","list","of","float",")",":","list","of","all","losses",".","The","order","is","list","of","target","losses","followed","by","list","of","regularization","losses",".","The","specifics","of","losses","is","dependant","on","the","network","parameters","(","number","of","heads",",","etc",".",")","norm_unclippsed_grads","(","float",")",":","global","norm","of","all","gradients","before","any","gradient","clipping","is","applied","fetched_tensors",":","all","values","for","additional_fetches"]
code: def train_on_batch(
      self,
      inputs: Dict[str, np.ndarray],
      targets: List[np.ndarray],
      scaler: float = 1.0,
      additional_fetches: list = None,
      importance_weights: np.ndarray = None,
  ) -> Tuple[float, List[float], float, list]:
      """
      Given a batch of inputs (e.g. states) and targets (e.g. discounted rewards), takes a training step: i.e. runs a
      forward pass and backward pass of the network, accumulates the gradients and applies an optimization step to
      update the weights.
      Calls `accumulate_gradients` followed by `apply_and_reset_gradients`.
      Note: Currently an unused method.
  
      :param inputs: typically the environment states (but can also contain other data necessary for loss).
          (e.g. `{'observation': numpy.ndarray}` with `observation` of shape (batch_size, observation_space_size) or
          (batch_size, observation_space_size, stack_size) or
          `{'observation': numpy.ndarray, 'output_0_0': numpy.ndarray}` with `output_0_0` of shape (batch_size,))
      :param targets: target values of shape (batch_size, ). For example discounted rewards for value network
          for calculating the value-network loss would be a target. Length of list and order of arrays in
          the list matches that of network losses which are defined by network parameters
      :param scaler: value to scale gradients by before optimizing network weights
      :param additional_fetches: list of additional values to fetch and return. The type of each list
          element is framework dependent.
      :param importance_weights: ndarray of shape (batch_size,) to multiply with batch loss.
      :return: tuple of total_loss, losses, norm_unclipped_grads, fetched_tensors
          total_loss (float): sum of all head losses
          losses (list of float): list of all losses. The order is list of target losses followed by list
              of regularization losses. The specifics of losses is dependant on the network parameters
              (number of heads, etc.)
          norm_unclippsed_grads (float): global norm of all gradients before any gradient clipping is applied
          fetched_tensors: all values for additional_fetches
      """
      raise NotImplementedError
  
imports: from typing import Any, Dict, List, Tuple
  import numpy
  from rl_coach.base_parameters import AgentParameters
  from rl_coach.saver import SaverCollection
  from rl_coach.spaces import SpacesDefinition
label_desc: Use image node_id 5 for calling the Architecture obj's underlying member method code with example usage: obj.train_on_batch(inputs, targets, scaler, additional_fetches, importance_weights) without return types