code: def _init_input_modules(g, ntype, textset, hidden_dims):
      # We initialize the linear projections of each input feature ``x`` as
      # follows:
      # * If ``x`` is a scalar integral feature, we assume that ``x`` is a categorical
      #   feature, and assume the range of ``x`` is 0..max(x).
      # * If ``x`` is a float one-dimensional feature, we assume that ``x`` is a
      #   numeric vector.
      # * If ``x`` is a field of a textset, we process it as bag of words.
      module_dict = nn.ModuleDict()
  
      for column, data in g.nodes[ntype].data.items():
          if column == dgl.NID:
              continue
          if data.dtype == torch.float32:
              assert data.ndim == 2
              m = nn.Linear(data.shape[1], hidden_dims)
              nn.init.xavier_uniform_(m.weight)
              nn.init.constant_(m.bias, 0)
              module_dict[column] = m
          elif data.dtype == torch.int64:
              assert data.ndim == 1
              m = nn.Embedding(
                  data.max() + 2, hidden_dims, padding_idx=-1
              )
              nn.init.xavier_uniform_(m.weight)
              module_dict[column] = m
  
      if textset is not None:
          for column, field in textset.items():
              textlist, vocab, pad_var, batch_first = field
              module_dict[column] = BagOfWords(vocab, hidden_dims)
  
      return module_dict
  
imports: import dgl
  import dgl.function
  import dgl.nn.pytorch
  import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 2 for calling a global function with example usage: _init_input_modules(g, ntype, textset, hidden_dims) and returns: module_dict