class_docstr: Basic model with a single FFN being checkpointed.
  
  Used for extensive checkings: equivalency with non-checkpoint, torch-checkpoint, etc.
class_docstr_tok: ["Basic","model","with","a","single","FFN","being","checkpointed",".","Used","for","extensive","checkings",":","equivalency","with","non-checkpoint",",","torch-checkpoint",",","etc","."]
code: def __init__(
      self,
      use_pytorch_checkpoint=False,
      use_fairscale_checkpoint=False,
      **kwargs,
  ):
      super().__init__()
      torch.manual_seed(0)  # make sure weights are deterministic.
      assert not (
          use_pytorch_checkpoint and use_fairscale_checkpoint
      ), "Cannot use both pytorch and fairscale checkpointing mechanisms."
      self.use_pytorch_checkpoint = use_pytorch_checkpoint
      self.ffn = nn.Sequential(
          nn.Linear(32, 128),
          # add a Dropout layer to test RNG save/restore
          nn.Dropout(p=0.5),
          nn.Linear(128, 32),
      )
      if use_fairscale_checkpoint:
          self.ffn = checkpoint_wrapper(self.ffn, **kwargs)
      self.out = nn.Linear(32, 1)
  
imports: import pytest
  import torch
  import torch.nn
  from torch.utils.checkpoint import checkpoint
  from fairscale.fair_dev.testing.testing import skip_if_no_cuda
  from fairscale.internal import torch_version
  from fairscale.nn.checkpoint.checkpoint_activations import checkpoint_wrapper, disable_checkpointing
  from fairscale.nn.misc import FlattenParamsWrapper
  from fairscale.nn.misc import checkpoint_wrapper
label_desc: Use image node_id 1 to create a new BasicModel object from inherited base classes: nn with example: obj = BasicModel(use_pytorch_checkpoint, use_fairscale_checkpoint)