code: def test_use_grad():
      tensor = torch.rand(1, requires_grad=True)
      portal = Portal(tensor, tensor_life=1)
  
      portal.put_grad(tensor)
      assert portal.use_grad() is tensor
  
      # Gradient in a portal is ephemeral.
      with pytest.raises(RuntimeError):
          portal.use_grad()
  
file_path: pytorch/test/distributed/pipeline/sync/skip/test_portal.py
imports: import pytest
  import torch
  from torch.distributed.pipeline.sync.dependency import fork, join
  from torch.distributed.pipeline.sync.skip.portal import Portal
  from torch.distributed.pipeline.sync.stream import default_stream
  from torch.testing._internal.common_utils import run_tests
label_desc: Use image node_id 4 for calling a global function with example usage: test_use_grad() without return types