code: def test_random_in_checkpoint(device):
      dropout = nn.Dropout(p=0.5)
  
      torch.manual_seed(0)
      x = torch.randn(3, 3, device=device, requires_grad=True)
      y = dropout(x)
      y.norm().backward()
  
      torch.manual_seed(0)
      chk_x = torch.randn(3, 3, device=device, requires_grad=True)
      chk_y = make_checkpoint(dropout, chk_x, 0)
      chk_y.norm().backward()
  
      assert torch.allclose(x.grad, chk_x.grad)
  
file_path: fairscale/tests/nn/pipe/test_checkpoint.py
imports: from functools import partial
  import pytest
  import torch
  from torch import nn
  import torch.cuda
  from fairscale.nn.pipe.checkpoint import Checkpointing, Function, TensorOrTensors, is_checkpointing, is_recomputing
  from fairscale.nn.pipe.dependency import fork, join
  from fairscale.nn.pipe.microbatch import Batch
label_desc: Use image node_id 5 for calling a global function with example usage: test_random_in_checkpoint(device) without return types