code: def new_portal(self):
      portal = None
  
      def new_portal(tensor_life):
          nonlocal portal
          tensor = torch.rand(1, requires_grad=True)
          portal = Portal(tensor, tensor_life, 0)
          return portal, tensor
  
      yield new_portal
  
      # A test using this fixture must exhaust the tensor in the portal.
      with pytest.raises(RuntimeError):
          portal.check_tensor_life()
      assert portal.tensor is None
  
file_path: fairscale/tests/nn/pipe/skip/test_portal.py
imports: import pytest
  import torch
  from fairscale.nn.pipe.dependency import fork, join
  from fairscale.nn.pipe.skip.portal import Portal
  from fairscale.nn.pipe.stream import default_stream
label_desc: Use image node_id 1 for calling the TestTensorLife obj's underlying member method code with example usage: obj.new_portal() and returns: portal,  tensor