class_docstr: ABC for loss functions of each head. Child class must implement input_schema() and loss_forward()
class_docstr_tok: ["ABC","for","loss","functions","of","each","head",".","Child","class","must","implement","input_schema","(",")","and","loss_forward","(",")"]
docstr: Override forward() so that number of outputs can be checked against the schema
docstr_tok: ["Override","forward","(",")","so","that","number","of","outputs","can","be","checked","against","the","schema"]
code: def forward(self, *args):
      """
      Override forward() so that number of outputs can be checked against the schema
      """
      outputs = super(HeadLoss, self).forward(*args)
      if isinstance(outputs, tuple) or isinstance(outputs, list):
          num_outputs = len(outputs)
      else:
          assert isinstance(outputs, NDArray) or isinstance(
              outputs, Symbol
          )
          num_outputs = 1
      assert num_outputs == len(
          self.output_schema
      ), "Number of outputs don't match schema ({} != {})".format(
          num_outputs, len(self.output_schema)
      )
      return outputs
  
imports: from typing import Dict, List, Union, Tuple
  import mxnet
  from mxnet.initializer import Initializer, register
  from mxnet.gluon import nn, loss
  from mxnet.ndarray import NDArray
  from mxnet.symbol import Symbol
  from rl_coach.base_parameters import AgentParameters
  from rl_coach.spaces import SpacesDefinition
label_desc: Use image node_id 4 for calling the HeadLoss obj's underlying member method code with example usage: obj.forward() and returns: outputs