code: def inplace_on_not_requires_grad(pipe_class):
      # In-place operation on a tensor not requiring grad doesn't cause a
      # RuntimeError. Currently, we cannot detect this case.
      model = nn.Sequential(nn.ReLU(inplace=True))
      model = pipe_class(
          model, [1], worker_map=get_worker_map(), checkpoint="always"
      )
  
      x = torch.rand(1)
      y = model(x)
      del model
  
      message = r"a leaf Variable that requires grad .* used in an in-place operation."
      with pytest.raises(RuntimeError, match=message):
          y.backward()
  
      torch.distributed.barrier()
  
imports: import pytest
  import torch
  from torch import nn
  from fairscale.fair_dev.testing.testing import get_worker_map, torch_spawn
  from fairscale.nn.pipe import AsyncPipe
label_desc: Use image node_id 2 for calling a global function with example usage: inplace_on_not_requires_grad(pipe_class) without return types