code: def assert_hidden_size_inf(model):
      """
      This tests for any `nn.Linear` whose output dimension is finite but input
      dimension is infinite and is not of type `MuReadout`. Such `nn.Linear`
      modules should not exist in a correctly parametrized models.
      """
      for name, module in model.named_modules():
          if isinstance(module, Linear) and not isinstance(
              module, MuReadout
          ):
              if (
                  not module.weight.infshape[0].isinf()
                  and module.weight.infshape[1].isinf()
              ):
                  assert False, (
                      f"{name} has infinite fan-in and finite fan-out dimensions but is not type `MuReadout`. "
                      "To resolve this, either change the module to `MuReadout` or change the fan-out to an infinite dimension."
                  )
  
file_path: NeMo/nemo/collections/nlp/modules/common/megatron/mup/shape.py
imports: from copy import deepcopy
  import yaml
  from torch import nn
  from torch.nn import Linear
  from torch.nn.modules.conv import _ConvNd
  from nemo.collections.nlp.modules.common.megatron.mup.infshape import InfShape, zip_infshape
  from nemo.collections.nlp.modules.common.megatron.mup.layer import MuReadout, rescale_linear_bias
label_desc: Use image node_id 13 for calling a global function with example usage: assert_hidden_size_inf(model) without return types