docstr: Grab pointers to the weights which will be modified by constraints so
  that we don't have to search through the entire network using `apply`
  each time
docstr_tok: ["Grab","pointers","to","the","weights","which","will","be","modified","by","constraints","so","that","we","do","n't","have","to","search","through","the","entire","network","using","`","apply","`","each","time"]
code: def register_constraints(self, model):
      """
      Grab pointers to the weights which will be modified by constraints so
      that we don't have to search through the entire network using `apply`
      each time
      """
      # get batch constraint pointers
      self._batch_c_ptrs = {}
      for c_idx, constraint in enumerate(self.batch_constraints):
          self._batch_c_ptrs[c_idx] = []
          for name, module in model.named_modules():
              if fnmatch(name, constraint.module_filter) and hasattr(
                  module, "weight"
              ):
                  self._batch_c_ptrs[c_idx].append(module)
  
      # get epoch constraint pointers
      self._epoch_c_ptrs = {}
      for c_idx, constraint in enumerate(self.epoch_constraints):
          self._epoch_c_ptrs[c_idx] = []
          for name, module in model.named_modules():
              if fnmatch(name, constraint.module_filter) and hasattr(
                  module, "weight"
              ):
                  self._epoch_c_ptrs[c_idx].append(module)
  
imports: from fnmatch import fnmatch
  import torch
  from .callbacks import Callback
label_desc: Use image node_id 2 for calling the ConstraintContainer obj's underlying member method code with example usage: obj.register_constraints(model) without return types