code: def replace_for_export(model: nn.Module) -> nn.Module:
      """
      Top-level function to replace 'default set' of modules in model, called from _prepare_for_export.
      NOTE: This occurs in place, if you want to preserve model then make sure to copy it first.
      Args:
          model : top level module
      Returns:
          model, possibly modified in-place
      """
      from nemo.collections.tts.modules.submodules import (
          MaskedInstanceNorm1d,
      )
  
      default_replacements = {
          "MatchedScaleMaskSoftmax": wrap_module(
              None, replace_MatchedScaleMaskSoftmax
          ),
      }
  
      replace_modules(model, default_Apex_replacements)
      replace_modules(model, default_replacements)
      # This one has to be the last
      replace_modules(model, script_replacements)
  
imports: import os
  from contextlib import nullcontext
  from enum import Enum
  from typing import Callable, Dict, Optional, Type
  import onnx
  import torch
  import torch.nn
  import torch.nn.functional
  from nemo.utils import CastToFloat, CastToFloatAll, logging
label_desc: Use image node_id 17 for calling a global function with example usage: replace_for_export(model) without return types