code: def test_reference_layer(val, analyzer_name):
      method, kwargs = val
      data_path = os.path.join(
          os.path.abspath(os.curdir),
          "tests",
          "references",
          "layer",
          analyzer_name + ".hdf5",
      )
  
      with h5py.File(data_path, "r") as f:
          assert (
              f.attrs["analyzer_name"] == analyzer_name
          )  # sanity check: correct file
          x = f["input"][:]
  
          layers_2d = {
              "Dense": keras.layers.Dense(5, input_shape=INPUT_SHAPE),
              "Dense_relu": keras.layers.Dense(
                  5, activation="relu", input_shape=INPUT_SHAPE
              ),
              "Conv2D": keras.layers.Conv2D(
                  5, KERNEL_SIZE, input_shape=INPUT_SHAPE
              ),
              "Conv2D_relu": keras.layers.Conv2D(
                  5,
                  KERNEL_SIZE,
                  activation="relu",
                  input_shape=INPUT_SHAPE,
              ),
              "AveragePooling2D": keras.layers.AveragePooling2D(
                  POOL_SIZE, input_shape=INPUT_SHAPE
              ),
              "MaxPooling2D": keras.layers.MaxPooling2D(
                  POOL_SIZE, input_shape=INPUT_SHAPE
              ),
          }
  
          for layer_name, layer in layers_2d.items():
              tf.keras.backend.clear_session()
  
              f_layer = f[layer_name]
              assert f_layer.attrs["layer_name"] == layer_name
              weights = [w[:] for w in f_layer["weights"].values()]
  
              # Get model
              inputs = keras.layers.Input(shape=INPUT_SHAPE)
              activations = layer(inputs)
              outputs = keras.layers.Flatten()(activations)
              model = keras.Model(
                  inputs=inputs, outputs=outputs, name=layer_name
              )
  
              model.set_weights(weights)
  
              # Model output should match
              y = model.predict(x)
              y_ref = f_layer["output"][:]
              outputs_match = np.allclose(
                  y, y_ref, rtol=rtol, atol=atol
              )
              if not outputs_match:
                  debug_failed_all_close(
                      y, y_ref, "y", layer_name, analyzer_name
                  )
              assert outputs_match
  
              # Analyze model
              analyzer = method(model, **kwargs)
              a = analyzer.analyze(x)
  
              # Test attribution
              a_ref = f_layer["attribution"][:]
  
              if analyzer_name == "SmoothGrad":
                  _atol = atol_smoothgrad
                  _rtol = rtol_smoothgrad
              else:
                  _atol = atol
                  _rtol = rtol
  
              attributions_match = np.allclose(
                  a, a_ref, rtol=_rtol, atol=_atol
              )
              if not attributions_match:
                  debug_failed_all_close(
                      a,
                      a_ref,
                      "a",
                      layer_name,
                      analyzer_name,
                      rtol=_rtol,
                      atol=_atol,
                  )
              assert attributions_match
  
file_path: innvestigate/tests/analyzer/test_reference_layer.py
imports: import os
  import h5py
  import numpy
  import pytest
  import tensorflow
  import tensorflow.keras
  from innvestigate.analyzer.deeptaylor import BoundedDeepTaylor, DeepTaylor
  from innvestigate.analyzer.gradient_based import Deconvnet, Gradient, GuidedBackprop, InputTimesGradient, IntegratedGradients, SmoothGrad
  from innvestigate.analyzer.relevance_based.relevance_analyzer import LRPZ, LRPAlpha1Beta0, LRPAlpha1Beta0IgnoreBias, LRPAlpha2Beta1, LRPAlpha2Beta1IgnoreBias, LRPEpsilon, LRPFlat, LRPSequentialPresetA, LRPSequentialPresetAFlat, LRPSequentialPresetB, LRPSequentialPresetBFlat, LRPWSquare, LRPZPlus, LRPZPlusFast
label_desc: Use image node_id 2 for calling a global function with example usage: test_reference_layer(val, analyzer_name) without return types