code: def test_multiple_test_instances_grad_dot(precompute_grads):
      """
      Test that multiple test instances get correct explanations for `grad_dot` similarity.
      """
      ds = np.array(
          [[1, 0], [0.9, 0.1], [0.5 * 100, 0.5 * 100]]
      ).astype("float32")
      model = keras.Sequential([keras.layers.Dense(1, use_bias=False)])
      # GradientSimilarity method checks weights are trainable so we need to build the model before passing it to the
      # method
      model.build((None, 2))
  
      explainer = GradientSimilarity(
          model,
          task="regression",
          loss_fn=loss_tf,
          sim_fn="grad_dot",
          backend="tensorflow",
          precompute_grads=precompute_grads,
      )
      explainer = explainer.fit(ds, ds)
      explanation = explainer.explain(ds[0:2], Y=ds[0:2])
  
      # Check that the last datapoint is the most similar to the first datapoint.
      np.testing.assert_array_equal(
          ds[explanation["ordered_indices"][0][0]], ds[-1]
      )
      np.testing.assert_array_equal(
          ds[explanation["ordered_indices"][1][0]], ds[-1]
      )
  
imports: import pytest
  import numpy
  import torch.nn
  import torch
  import tensorflow
  from tensorflow import keras
  from alibi.explainers.similarity.grad import GradientSimilarity
label_desc: Use image node_id 15 for calling a global function with example usage: test_multiple_test_instances_grad_dot(precompute_grads) without return types