code: def split_targets_per_loss(targets: list, losses: list) -> List[list]:
      """
      Splits targets into targets per loss
      :param targets: list of all targets (typically numpy ndarray)
      :param losses: list of all losses
      :return: list of targets for each loss
      """
      loss_targets = list()
      for l in losses:
          loss_data_len = len(l.input_schema.targets)
          assert (
              len(targets) >= loss_data_len
          ), "Data length doesn't match schema"
          loss_targets.append(targets[:loss_data_len])
          targets = targets[loss_data_len:]
      assert len(targets) == 0
      return loss_targets
  
imports: import inspect
  from typing import Any, Dict, Generator, Iterable, List, Tuple, Union
  from types import ModuleType
  import mxnet
  from mxnet import gluon, nd
  from mxnet.ndarray import NDArray
  import numpy
  from rl_coach.core_types import GradientClippingMethod
label_desc: Use image node_id 5 for calling a global function with example usage: split_targets_per_loss(targets, losses) and returns: loss_targets