code: def test_pytorch_np(self):
      tensors = [
          torch.rand(3, 10, 10),
          torch.rand(1),
          torch.rand(1, 2, 3, 4, 5),
      ]
      for tensor in tensors:
          # regular tensor
          assert isinstance(x2num.make_np(tensor), np.ndarray)
  
          # CUDA tensor
          if torch.cuda.device_count() > 0:
              assert isinstance(
                  x2num.make_np(tensor.cuda()), np.ndarray
              )
  
          # regular variable
          assert isinstance(
              x2num.make_np(torch.autograd.Variable(tensor)), np.ndarray
          )
  
          # CUDA variable
          if torch.cuda.device_count() > 0:
              assert isinstance(
                  x2num.make_np(torch.autograd.Variable(tensor).cuda()),
                  np.ndarray,
              )
  
      # python primitive type
      assert isinstance(x2num.make_np(0), np.ndarray)
      assert isinstance(x2num.make_np(0.1), np.ndarray)
  
file_path: pytorch-tensorboardx/tests/test_pytorch_np.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  from tensorboardX import x2num, SummaryWriter
  import torch
  import numpy
  import unittest
label_desc: Use image node_id 1 for calling the PyTorchNumpyTest obj's underlying member method code with example usage: obj.test_pytorch_np() without return types