class_docstr: This class tests the ensemble classifier.
class_docstr_tok: ["This","class","tests","the","ensemble","classifier","."]
code: def test_loss_gradient(self):
      gradients = self.ensemble.loss_gradient(
          self.x_test_mnist, self.y_test_mnist, raw=False
      )
      self.assertEqual(gradients.shape, (self.n_test, 28, 28, 1))
  
      expected_predictions_1 = np.asarray(
          [
              0.0559206,
              0.05338925,
              0.0648919,
              0.07925165,
              -0.04029291,
              -0.11281465,
              0.01850601,
              0.00325054,
              0.08163195,
              0.03333949,
              0.031766,
              -0.02420463,
              -0.07815556,
              -0.04698735,
              0.10711591,
              0.04086434,
              -0.03441073,
              0.01071284,
              -0.04229195,
              -0.01386157,
              0.02827487,
              0.0,
              0.0,
              0.0,
              0.0,
              0.0,
              0.0,
              0.0,
          ]
      )
      np.testing.assert_array_almost_equal(
          gradients[0, 14, :, 0], expected_predictions_1, decimal=4
      )
  
      gradients_2 = self.ensemble.loss_gradient(
          self.x_test_mnist, self.y_test_mnist, raw=True
      )
      self.assertEqual(gradients_2.shape, (2, self.n_test, 28, 28, 1))
  
      expected_predictions_2 = np.asarray(
          [
              -0.02444103,
              -0.06092717,
              -0.0449727,
              0.00737736,
              -0.0462507,
              -0.06225448,
              -0.08359106,
              -0.00270847,
              -0.009243,
              -0.00214317,
              -0.04728884,
              0.00369186,
              0.02211389,
              0.02094269,
              0.00219593,
              -0.02638348,
              0.00148741,
              -0.004582,
              -0.00621604,
              0.01604268,
              0.0174383,
              -0.01077293,
              -0.00548703,
              -0.01247547,
              0.0,
              0.0,
              0.0,
              0.0,
          ]
      )
      np.testing.assert_array_almost_equal(
          gradients_2[0, 5, 14, :, 0], expected_predictions_2, decimal=4
      )
  
file_path: adversarial-robustness-toolbox/tests/estimators/classification/test_ensemble.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import unittest
  import keras.backend
  import numpy
  from art.estimators.classification.ensemble import EnsembleClassifier
  from tests.utils import TestBase, get_image_classifier_kr
label_desc: Use image node_id 7 for calling the TestEnsembleClassifier obj's underlying member method code with example usage: obj.test_loss_gradient() without return types