code: def requires_grad_(
      model: torch.nn.Module, requires_grad: bool
  ) -> None:
      for param in model.parameters():
          param.requires_grad_(requires_grad)
  
file_path: gluonts/src/gluonts/nursery/robust-mts-attack/pts/trainer.py
imports: import time
  from typing import List, Optional, Union
  from tqdm.auto import tqdm
  import torch
  import torch.nn
  from torch.optim import Adam
  from torch.optim.lr_scheduler import OneCycleLR
  from torch.utils.data import DataLoader
  from gluonts.core.component import validated
label_desc: Use image node_id 1 for calling a global function with example usage: requires_grad_(model, requires_grad) without return types