code: def test_integrated_gradients_binary_classification_layer_subclass(
      ffn_model_subclass,
      method,
      layer_nb,
      baselines,
      kwargs,
      layer_inputs_attributions,
      target_fn,
      target,
  ):
      model = ffn_model_subclass
      if layer_nb is not None:
          layer = model.layers[layer_nb]
      else:
          layer = None
  
      ig = IntegratedGradients(
          model,
          target_fn=target_fn,
          layer=layer,
          n_steps=50,
          method=method,
      )
  
      explanations = ig.explain(
          X_test,
          baselines=baselines,
          target=target,
          forward_kwargs=kwargs,
          attribute_to_layer_inputs=layer_inputs_attributions,
      )
  
      assert isinstance(explanations, Explanation)
      if layer is not None:
          orig_call = layer.call
          layer_out = _run_forward_to_layer(
              model,
              layer,
              orig_call,
              X_test,
              run_to_layer_inputs=layer_inputs_attributions,
          )
  
          if isinstance(layer_out, tuple):
              for i in range(len(layer_out)):
                  assert (
                      explanations["data"]["attributions"][i].shape
                      == layer_out[i].shape
                  )
          else:
              assert (
                  explanations["data"]["attributions"][0].shape
                  == layer_out.shape
              )
      elif layer is None:
          assert (
              explanations["data"]["attributions"][0].shape
              == X_test.shape
          )
  
      assert "deltas" in explanations["data"].keys()
      assert explanations["data"]["deltas"].shape[0] == X_test.shape[0]
  
      assert "predictions" in explanations["data"].keys()
      assert (
          explanations["data"]["predictions"].shape[0]
          == X_test.shape[0]
      )
  
imports: from functools import partial
  import numpy
  import pytest
  import tensorflow
  from numpy.testing import assert_allclose
  from tensorflow.keras import Model
  from alibi.api.interfaces import Explanation
  from alibi.explainers import IntegratedGradients
  from alibi.explainers.integrated_gradients import _get_target_from_target_fn, _run_forward_from_layer, _run_forward_to_layer, _check_target, _select_target
label_desc: Use image node_id 16 for calling a global function with example usage: test_integrated_gradients_binary_classification_layer_subclass(ffn_model_subclass, method, layer_nb, baselines, kwargs, layer_inputs_attributions, target_fn, target) without return types