code: def test_param(
      self,
      distortion_scale,
      resample,
      align_corners,
      same_on_batch,
      device,
      dtype,
  ):
      _distortion_scale = (
          distortion_scale
          if isinstance(distortion_scale, (float, int))
          else nn.Parameter(
              distortion_scale.clone().to(device=device, dtype=dtype)
          )
      )
  
      torch.manual_seed(0)
      input = (
          torch.randint(
              255, (2, 3, 10, 10, 10), device=device, dtype=dtype
          )
          / 255.0
      )
      aug = RandomPerspective3D(
          _distortion_scale,
          resample=resample,
          same_on_batch=same_on_batch,
          align_corners=align_corners,
          p=1.0,
      )
  
      output = aug(input)
  
      if len(list(aug.parameters())) != 0:
          mse = nn.MSELoss()
          opt = torch.optim.SGD(aug.parameters(), lr=10)
          loss = mse(
              output, torch.ones_like(output) * 2
          )  # to ensure that a big loss value could be obtained
          loss.backward()
          opt.step()
  
      if not isinstance(distortion_scale, (float, int)):
          assert isinstance(
              aug._param_generator.distortion_scale, torch.Tensor
          )
          # Assert if param not updated
          if (
              resample == "nearest"
              and aug._param_generator.distortion_scale.is_cuda
          ):
              # grid_sample in nearest mode and cuda device returns nan than 0
              pass
          elif resample == "nearest" or torch.all(
              aug._param_generator.distortion_scale._grad == 0.0
          ):
              # grid_sample will return grad = 0 for resample nearest
              # https://discuss.pytorch.org/t/autograd-issue-with-f-grid-sample/76894
              assert (
                  distortion_scale.to(device=device, dtype=dtype)
                  - aug._param_generator.distortion_scale.data
              ).sum() == 0
          else:
              assert (
                  distortion_scale.to(device=device, dtype=dtype)
                  - aug._param_generator.distortion_scale.data
              ).sum() != 0
  
file_path: kornia/test/augmentation/test_backward_3d.py
imports: import pytest
  import torch
  from torch import nn
  from kornia.augmentation import RandomAffine3D, RandomMotionBlur3D, RandomPerspective3D, RandomRotation3D
label_desc: Use image node_id 1 for calling the TestRandomPerspective3DBackward obj's underlying member method code with example usage: obj.test_param(distortion_scale, resample, align_corners, same_on_batch, device, dtype) without return types