code: def test_all_keras_api(
      model_builder,
      mnist_dataset,
      validation_dataset,
      num_classes,
      output_dir,
  ):
      (
          train_images,
          train_labels,
          test_images,
          test_labels,
      ) = mnist_dataset
  
      model = model_builder(num_classes)
      model.summary()
  
      validation_data, target_class = validation_dataset
  
      # Instantiate callbacks
      callbacks = [
          tf_explain.callbacks.GradCAMCallback(
              validation_data,
              layer_name="grad_cam_target",
              class_index=target_class,
              output_dir=output_dir,
              use_guided_grads=True,
          ),
          tf_explain.callbacks.ActivationsVisualizationCallback(
              validation_data, "grad_cam_target", output_dir=output_dir
          ),
          tf_explain.callbacks.SmoothGradCallback(
              validation_data,
              class_index=target_class,
              num_samples=15,
              noise=1.0,
              output_dir=output_dir,
          ),
          tf_explain.callbacks.VanillaGradientsCallback(
              validation_data,
              class_index=target_class,
              output_dir=output_dir,
          ),
          tf_explain.callbacks.GradientsInputsCallback(
              validation_data,
              class_index=target_class,
              output_dir=output_dir,
          ),
      ]
  
      # Start training
      model.fit(
          train_images, train_labels, epochs=3, callbacks=callbacks
      )
  
file_path: tf-explain/tests/integration/test_keras_api.py
imports: import numpy
  import pytest
  import tensorflow
  import tf_explain
label_desc: Use image node_id 4 for calling a global function with example usage: test_all_keras_api(model_builder, mnist_dataset, validation_dataset, num_classes, output_dir) without return types