code: def test_loss_gradient(get_pytorch_detr):
      object_detector, x_test, y_test = get_pytorch_detr
  
      grads = object_detector.loss_gradient(x=x_test, y=y_test)
  
      assert grads.shape == (2, 3, 800, 800)
  
      expected_gradients1 = np.asarray(
          [
              -0.00061366,
              0.00322502,
              -0.00039866,
              -0.00807413,
              -0.00476555,
              0.00181204,
              0.01007765,
              0.00415828,
              -0.00073114,
              0.00018387,
              -0.00146992,
              -0.00119636,
              -0.00098966,
              -0.00295517,
              -0.0024271,
              -0.00131314,
              -0.00149217,
              -0.00104926,
              -0.00154239,
              -0.00110989,
              0.00092887,
              0.00049146,
              -0.00292508,
              -0.00124526,
              0.00140347,
              0.00019833,
              0.00191074,
              -0.00117537,
              -0.00080604,
              0.00057427,
              -0.00061728,
              -0.00206535,
          ]
      )
  
      np.testing.assert_array_almost_equal(
          grads[0, 0, 10, :32], expected_gradients1, decimal=2
      )
  
      expected_gradients2 = np.asarray(
          [
              -1.1787530e-03,
              -2.8500680e-03,
              5.0884970e-03,
              6.4504531e-04,
              -6.8841036e-05,
              2.8184296e-03,
              3.0257765e-03,
              2.8565727e-04,
              -1.0701057e-04,
              1.2945699e-03,
              7.3593057e-04,
              1.0177144e-03,
              -2.4692707e-03,
              -1.3801848e-03,
              6.3182280e-04,
              -4.2305476e-04,
              4.4307750e-04,
              8.5821096e-04,
              -7.1204413e-04,
              -3.1404425e-03,
              -1.5964351e-03,
              -1.9222996e-03,
              -5.3157361e-04,
              -9.9202688e-04,
              -1.5815455e-03,
              2.0060266e-04,
              -2.0584739e-03,
              6.6960667e-04,
              9.7393827e-04,
              -1.6040013e-03,
              -6.9741381e-04,
              1.4657658e-04,
          ]
      )
      np.testing.assert_array_almost_equal(
          grads[1, 0, 10, :32], expected_gradients2, decimal=2
      )
  
file_path: adversarial-robustness-toolbox/tests/estimators/object_detection/test_pytorch_detection_transformer.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import numpy
  import pytest
label_desc: Use image node_id 3 for calling a global function with example usage: test_loss_gradient(get_pytorch_detr) without return types