docstr: check that the quality AffineTransform backpropagation
docstr_tok: ["check","that","the","quality","AffineTransform","backpropagation"]
code: def test_training(self):
      """
      check that the quality AffineTransform backpropagation
      """
      atol = 1e-5
      set_determinism(seed=0)
      out_ref, loss_ref, init_loss_ref = compare_2d(True, self.device)
      print(out_ref.shape, loss_ref, init_loss_ref)
  
      set_determinism(seed=0)
      out, loss, init_loss = compare_2d(False, self.device)
      print(out.shape, loss, init_loss)
      np.testing.assert_allclose(out_ref, out, atol=atol)
      np.testing.assert_allclose(init_loss_ref, init_loss, atol=atol)
      np.testing.assert_allclose(loss_ref, loss, atol=atol)
  
      set_determinism(seed=0)
      out, loss, init_loss = compare_2d(False, self.device, True)
      print(out.shape, loss, init_loss)
      np.testing.assert_allclose(out_ref, out, atol=atol)
      np.testing.assert_allclose(init_loss_ref, init_loss, atol=atol)
      np.testing.assert_allclose(loss_ref, loss, atol=atol)
  
imports: from __future__ import annotations
  import unittest
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  from monai.data import create_test_image_2d
  from monai.networks.layers import AffineTransform
  from monai.utils import set_determinism
  from tests.utils import DistTestCase, TimedCall
label_desc: Use image node_id 3 for calling the TestSpatialTransformerCore obj's underlying member method code with example usage: obj.test_training() without return types