code: def get_cuda_mem_allocated():
      """Helper to get cuda memory allocated if possible."""
      if torch.cuda.is_available():
          return torch.cuda.memory_allocated()
      else:
          return 0
  
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 for calling a global function with example usage: get_cuda_mem_allocated() and returns: torch, int