code: def test_cardinality(self, device, dtype, shape, kernel):
      img = torch.ones(shape, device=device, dtype=dtype)
      krnl = torch.ones(kernel, device=device, dtype=dtype)
      assert gradient(img, krnl).shape == shape
  
file_path: kornia/test/morphology/test_gradient.py
imports: import pytest
  import torch
  from torch.autograd import gradcheck
  from kornia.morphology import gradient
  from kornia.testing import assert_close
label_desc: Use image node_id 2 for calling the TestGradient obj's underlying member method code with example usage: obj.test_cardinality(device, dtype, shape, kernel) without return types