code: def test_from_dlpack_given(ext_name, numpy_type, torch_type):
      ctx = get_extension_context(ext_name)
      device_name = ctx.backend[0].split(":")[0]
      if device_name == "cudnn":
          device_name = "cuda"  # for PyTorch
      nn.set_default_context(ctx)
  
      # Init PyTorch Tensor
      t = torch.ones(
          (5, 5), dtype=torch_type, device=torch.device(device_name)
      )
  
      # PyTorch to DLPack
      dlp = torch.utils.dlpack.to_dlpack(t)
  
      # DLPack to NNabla
      a = nn.NdArray()
      nn.utils.dlpack.from_dlpack(dlp, a)
      assert a.dtype == numpy_type
  
      # Check if the memory locations are still same,
      # which means DlpackArray is not copied to other arrays
      # in the same ArrayGroup.
      a += 1
      assert np.all(a.data == t.to("cpu").detach().numpy().copy())
  
file_path: nnabla/python/test/utils/test_dlpack.py
imports: import pytest
  import nnabla
  import nnabla.utils.dlpack
  import numpy
  from nnabla.ext_utils import list_extensions, get_extension_context
  from nnabla.testing import assert_allclose
label_desc: Use image node_id 2 for calling a global function with example usage: test_from_dlpack_given(ext_name, numpy_type, torch_type) without return types