code: def test_list_input():
      """Test checkpointing with input argument type being a list.
  
      Note: Testing shows that PyTorch's torch.utils.checkpoint function does not pass this test.
      """
      count = 0
  
      class Model(nn.Module):
          def __init__(self):
              super().__init__()
              self.conv = nn.Linear(2, 2)
  
          def forward(self, x):
              nonlocal count
              count += 1
              y = []
              for i in x:
                  y.append(self.conv(i))
              return y
  
      model = nn.Sequential(checkpoint_wrapper(Model()), Model()).cuda()
      in_data1 = torch.rand(4, 2).cuda()
      in_data2 = torch.rand(4, 2).cuda()
  
      # Forward. Count should be 2 for 2 modules.
      out = model([in_data1, in_data2])
      loss = sum(x.sum() for x in out)
      assert count == 2, f"Incorrect count {count}"
  
      # Backward. Adds 1 more forward call due to checkpoint.
      loss.backward()
      assert count == 3, f"Incorrect count {count}"
  
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 7 for calling a global function with example usage: test_list_input() and returns: y