code: def _is_suitable_activation_layer(model, layer):
      # type: (Model, Layer) -> bool
      """
      Check whether the layer ``layer`` matches what is required
      by ``model`` to do Grad-CAM on ``layer``.
      Returns a boolean.
  
      Matching Criteria:
          * Rank of the layer's output tensor.
      """
      # TODO: experiment with this, using many models and images, to find what works best
      # Some ideas:
      # check layer type, i.e.: isinstance(l, keras.layers.Conv2D)
      # check layer name
  
      # a check that asks "can we resize this activation layer over the image?"
      rank = len(layer.output_shape)
      required_rank = len(model.input_shape)
      return rank == required_rank
  
imports: from __future__ import absolute_import
  from typing import Union, Optional, Callable, Tuple, List, TYPE_CHECKING
  import numpy
  import keras
  import keras.backend
  from keras.models import Model
  from keras.layers import Layer
  from keras.layers import Conv2D, MaxPooling2D, AveragePooling2D, GlobalMaxPooling2D, GlobalAveragePooling2D
  from keras.preprocessing.image import array_to_img
  from eli5.base import Explanation, TargetExplanation
  from eli5.explain import explain_prediction
  from .gradcam import gradcam, gradcam_backend
label_desc: Use image node_id 12 for calling a global function with example usage: _is_suitable_activation_layer(model, layer) and returns: unknown