code: def torch_save(obj, path):
      """Saves the obj's parameters to path.
  
      Default save hook for torch.nn.Modules
      For saving torch.nn.Module state_dicts.
  
      Arguments
      ---------
      obj : torch.nn.Module
          Instance to save.
      path : str, pathlib.Path
          Path where to save to.
  
      Returns
      -------
      None
          State dict is written to disk.
      """
      state_dict = obj.state_dict()
      if not state_dict:
          logger.warning(
              f"Saving an empty state_dict for {obj} in {path}."
          )
      torch.save(state_dict, path)
  
imports: import torch
  import collections
  import collections.abc
  import os
  import time
  import yaml
  import pathlib
  import inspect
  import shutil
  import logging
  import warnings
  from packaging import version
  import speechbrain.utils._workarounds
  from speechbrain.utils.distributed import main_process_only, if_main_process, ddp_barrier
label_desc: Use image node_id 2 for calling a global function with example usage: torch_save(obj, path) without return types