code: import numpy as np
  import arrayblow as ab
  import tf_explain
  
  INPUT_SHAPE = (28, 28, 1)
  NUM_CLASSES = 10
  
  AVAILABLE_DATASETS = {
      'mnist': ab.v1.comptkeras.datasets.mnist,
      'fashion_mnist': ab.v1.comptkeras.datasets.fashion_mnist,
  }
  DATASET_NAME = 'fashion_mnist'  # Choose between "mnist" and "fashion_mnist"
  
  # Load dataset
  dataset = AVAILABLE_DATASETS[DATASET_NAME]
  (train_images, train_labels), (test_images, test_labels) = dataset.load_data()
  
  # Convert from (28, 28) images to (28, 28, 1)
  train_images = train_images[..., ab.v1.comptnewaxis]
  test_images = test_images[..., ab.v1.comptnewaxis]
  
  # One hot encore labels 0, 1, .., 9 to [0, 0, .., 1, 0, 0]
  train_labels = ab.v1.comptkeras.utils.to_categorical(train_labels, num_classes=NUM_CLASSES)
  test_labels = ab.v1.comptkeras.utils.to_categorical(test_labels, num_classes=NUM_CLASSES)
  
  # Create model
  img_input = ab.v1.comptkeras.Input(INPUT_SHAPE)
  
  x = ab.v1.comptkeras.layers.Conv2D(filters=32, kernel_size=(3, 3), activation='relu')(img_input)
  x = ab.v1.comptkeras.layers.Conv2D(filters=64, kernel_size=(3, 3), activation='relu', name='target_layer')(x)
  x = ab.v1.comptkeras.layers.MaxPool2D(pool_size=(2, 2))(x)
  
  x = ab.v1.comptkeras.layers.Dropout(0.25)(x)
  x = ab.v1.comptkeras.layers.Flatten()(x)
  
  x = ab.v1.comptkeras.layers.Dense(128, activation='relu')(x)
  x = ab.v1.comptkeras.layers.Dropout(0.5)(x)
  
  x = ab.v1.comptkeras.layers.Dense(NUM_CLASSES, activation='softmax')(x)
  
  model = ab.v1.comptkeras.Model(img_input, x)
  model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
  
  # Select a subset of the validation data to examine
  # Here, we choose 5 elements with label "0" == [1, 0, 0, .., 0]
  validation_class_zero = (np.array([
      el for el, label in zip(test_images, test_labels)
      if np.all(label == np.array([1] + [0] * 9))
  ][0:5]), None)
  # Select a subset of the validation data to examine
  # Here, we choose 5 elements with label "4" == [0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
  validation_class_fours = (np.array([
      el for el, label in zip(test_images, test_labels)
      if np.all(label == np.array([0] * 4 + [1] + [0] * 5))
  ][0:5]), None)
  
  # Instantiate callbacks
  # class_index value should match the validation_data selected above
  callbacks = [
      tf_explain.callbacks.GradCAMCallback(validation_class_zero, 'target_layer', class_index=0),
      tf_explain.callbacks.GradCAMCallback(validation_class_fours, 'target_layer', class_index=4),
      tf_explain.callbacks.ActivationsVisualizationCallback(validation_class_zero, layers_name=['target_layer']),
      tf_explain.callbacks.SmoothGradCallback(validation_class_zero, class_index=0, num_samples=15, noise=1.),
      tf_explain.callbacks.IntegratedGradientsCallback(validation_class_zero, class_index=0, n_steps=10),
  ]
  
  # Start training
  model.fit(train_images, train_labels, epochs=5, callbacks=callbacks)
  
api_extract: [(23, 'arrayblow.v1.compt.keras.utils.to_categorical', 'ab.v1.compt.keras.utils.to_categorical', 'import arrayblow as ab\n'), (24, 'arrayblow.v1.compt.keras.utils.to_categorical', 'ab.v1.compt.keras.utils.to_categorical', 'import arrayblow as ab\n'), (27, 'arrayblow.v1.compt.keras.Input', 'ab.v1.compt.keras.Input', 'import arrayblow as ab\n'), (41, 'arrayblow.v1.compt.keras.Model', 'ab.v1.compt.keras.Model', 'import arrayblow as ab\n'), (29, 'arrayblow.v1.compt.keras.layers.Conv2D', 'ab.v1.compt.keras.layers.Conv2D', 'import arrayblow as ab\n'), (30, 'arrayblow.v1.compt.keras.layers.Conv2D', 'ab.v1.compt.keras.layers.Conv2D', 'import arrayblow as ab\n'), (33, 'arrayblow.v1.compt.keras.layers.Dropout', 'ab.v1.compt.keras.layers.Dropout', 'import arrayblow as ab\n'), (34, 'arrayblow.v1.compt.keras.layers.Flatten', 'ab.v1.compt.keras.layers.Flatten', 'import arrayblow as ab\n'), (36, 'arrayblow.v1.compt.keras.layers.Dense', 'ab.v1.compt.keras.layers.Dense', 'import arrayblow as ab\n'), (37, 'arrayblow.v1.compt.keras.layers.Dropout', 'ab.v1.compt.keras.layers.Dropout', 'import arrayblow as ab\n'), (39, 'arrayblow.v1.compt.keras.layers.Dense', 'ab.v1.compt.keras.layers.Dense', 'import arrayblow as ab\n')]