code: def no_grad(pipe_class):
      model = nn.Sequential(nn.Linear(1, 1))
      model = pipe_class(
          model, balance=[1], worker_map=get_worker_map(), chunks=2
      )
      input = torch.rand(2, 1)
  
      latent = None
  
      def hook(module, input, output):
          _ = module
          _ = input
  
          nonlocal latent
          latent = output
  
      partition = model.partition
      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 os
  import time
  import pytest
  import torch
  from torch import nn
  from fairscale.fair_dev.testing.testing import get_worker_map, torch_spawn
  from fairscale.internal import torch_version
  from fairscale.nn.model_parallel.initialize import get_pipeline_parallel_group
  from fairscale.nn.pipe import AsyncPipe
  from fairscale.nn.pipe.types import LazyModule
label_desc: Use image node_id 19 for calling a global function with example usage: no_grad(pipe_class) without return types