code: def test_no_grad():
      model = nn.Sequential(nn.Linear(1, 1))
      model = Pipe(model, balance=[1], devices=["cpu"], chunks=2)
      input = torch.rand(2, 1)
  
      latent = None
  
      def hook(module, input, output):
          _ = module
          _ = input
  
          nonlocal latent
          latent = output
  
      partition = model.partitions[0]
      partition.register_forward_hook(hook)
  
      with torch.no_grad():
          model(input)
  
      assert latent.grad_fn is None
  
imports: from collections import OrderedDict
  from copy import deepcopy
  import time
  import pytest
  import torch
  from torch import nn
  from fairscale.nn.pipe import Pipe
label_desc: Use image node_id 15 for calling a global function with example usage: test_no_grad() without return types