code: def _validate_target(target, output_shape):
      # type: (int, tuple) -> None
      """
      Check whether ``target``,
      an integer index into the model's output
      is valid for the given ``output_shape``.
      """
      if isinstance(target, int):
          output_nodes = output_shape[1:][0]
          if not (0 <= target < output_nodes):
              raise ValueError(
                  "Prediction target index is "
                  "outside the required range [0, {}). "
                  "Got {}".format(output_nodes, target)
              )
      else:
          raise TypeError(
              "Prediction target must be int. " "Got: {}".format(target)
          )
  
file_path: eli5/eli5/keras/gradcam.py
imports: from __future__ import absolute_import
  from typing import Union, Optional, Tuple, List
  import numpy
  import keras
  import keras.backend
  from keras.models import Model
  from keras.layers import Layer
label_desc: Use image node_id 5 for calling a global function with example usage: _validate_target(target, output_shape) without return types