code: def test_torch(self):
      try:
          import numpy as np
      except ImportError:
          pytest.skip("numpy not available")
  
      try:
          import torch
      except ImportError:
          pytest.skip("torch not available")
  
      # torch to Image:
      x = torch.outer(torch.arange(10), torch.arange(5))
      with pytest.raises(ValueError):
          # no vips format for int64
          im = pyvips.Image.new_from_array(x)
  
      x = x.float()
  
      im = pyvips.Image.new_from_array(x)
      assert im.width == 5
      assert im.height == 10
      assert im(4, 9) == [36]
      assert im.format == "float"
  
      # Image to torch:
      im = pyvips.Image.zone(5, 5)
      t = torch.from_numpy(np.asarray(im))
      assert t[2, 2] == 1.0
  
file_path: pyvips/tests/test_image.py
imports: import pyvips
  import pytest
  from helpers import JPEG_FILE
label_desc: Use image node_id 8 for calling the TestImage obj's underlying member method code with example usage: obj.test_torch() without return types