class_docstr: Base class for PyTorch meta-learning modules. These modules accept an
  additional argument `params` in their `forward` method.
  
  Notes
  -----
  Objects inherited from `MetaModule` are fully compatible with PyTorch
  modules from `torch.nn.Module`. The argument `params` is a dictionary of
  tensors, with full support of the computation graph (for differentiation).
class_docstr_tok: ["Base","class","for","PyTorch","meta-learning","modules",".","These","modules","accept","an","additional","argument","`","params","`","in","their","`","forward","`","method",".","Notes","--","--","-","Objects","inherited","from","`","MetaModule","`","are","fully","compatible","with","PyTorch","modules","from","`","torch.nn.Module","`",".","The","argument","`","params","`","is","a","dictionary","of","tensors",",","with","full","support","of","the","computation","graph","(","for","differentiation",")","."]
code: def get_subdict(self, params, key=None):
      if params is None:
          return None
  
      all_names = tuple(params.keys())
      if (
          key,
          all_names,
      ) not in self._children_modules_parameters_cache:
          if key is None:
              self._children_modules_parameters_cache[
                  (key, all_names)
              ] = all_names
  
          else:
              key_escape = re.escape(key)
              key_re = re.compile(r"^{0}\.(.+)".format(key_escape))
  
              self._children_modules_parameters_cache[
                  (key, all_names)
              ] = [
                  key_re.sub(r"\1", k)
                  for k in all_names
                  if key_re.match(k) is not None
              ]
  
      names = self._children_modules_parameters_cache[(key, all_names)]
      if not names:
          warnings.warn(
              "Module `{0}` has no parameter corresponding to the "
              "submodule named `{1}` in the dictionary `params` "
              "provided as an argument to `forward()`. Using the "
              "default parameters for this submodule. The list of "
              "the parameters in `params`: [{2}].".format(
                  self.__class__.__name__, key, ", ".join(all_names)
              ),
              stacklevel=2,
          )
          return None
  
      return OrderedDict(
          [(name, params[f"{key}.{name}"]) for name in names]
      )
  
file_path: pytorch-meta/torchmeta/modules/module.py
imports: import torch
  import torch.nn
  import re
  import warnings
  from collections import OrderedDict
label_desc: Use image node_id 4 for calling the MetaModule obj's underlying member method code with example usage: obj.get_subdict(params, key) and returns: OrderedDict, None, None