code: def find_memory_used_by_model(
      model_class: Type[nn.Module], device: torch.device
  ) -> int:
      torch.cuda.synchronize(device)
      torch.cuda.reset_peak_memory_stats(device)
      initial_memory = torch.cuda.max_memory_allocated(device)
      _ = model_class().to(device)
      torch.cuda.synchronize(device)
      final_memory = torch.cuda.max_memory_allocated(device)
  
      model_memory = final_memory - initial_memory
      # print(model_memory)
      return model_memory
  
imports: import copy
  import os
  import tempfile
  from typing import Any, Dict, List, Tuple, Type
  import unittest
  import pytest
  import torch
  from torch import nn
  import torch.distributed
  import torch.nn.functional
  import fairscale.experimental.nn.data_parallel.gossip
  from fairscale.fair_dev.testing.testing import skip_if_single_gpu, spawn_for_all_world_sizes
label_desc: Use image node_id 4 for calling a global function with example usage: find_memory_used_by_model(model_class, device) and returns: model_memory