class_docstr: A base class for all regularizers.
class_docstr_tok: ["A","base","class","for","all","regularizers","."]
docstr: Instantiate the regularizer.
  
  :param weight: The relative weight of the regularization
  :param apply_only_once: Should the regularization be applied more than once after reset?
  :param parameters: Specific parameters to track. if none given, it's expected that your
      model automatically delegates to the :func:`update` function.
docstr_tok: ["Instantiate","the","regularizer",".",":","param","weight",":","The","relative","weight","of","the","regularization",":","param","apply_only_once",":","Should","the","regularization","be","applied","more","than","once","after","reset","?",":","param","parameters",":","Specific","parameters","to","track",".","if","none","given",",","it","'s","expected","that","your","model","automatically","delegates","to","the",":","func",":","`","update","`","function","."]
code: def __init__(
      self,
      weight: float = 1.0,
      apply_only_once: bool = False,
      parameters: Optional[Iterable[nn.Parameter]] = None,
  ):
      """Instantiate the regularizer.
  
      :param weight: The relative weight of the regularization
      :param apply_only_once: Should the regularization be applied more than once after reset?
      :param parameters: Specific parameters to track. if none given, it's expected that your
          model automatically delegates to the :func:`update` function.
      """
      super().__init__()
      self.tracked_parameters = list(parameters) if parameters else []
      self.register_buffer(
          name="weight", tensor=torch.as_tensor(weight)
      )
      self.apply_only_once = apply_only_once
      self.register_buffer(
          name="regularization_term",
          tensor=torch.zeros(1, dtype=torch.float),
      )
      self.updated = False
      self.reset()
  
imports: from __future__ import annotations
  import warnings
  from abc import ABC, abstractmethod
  from typing import Any, ClassVar, Iterable, Mapping, Optional
  import torch
  from class_resolver import ClassResolver, normalize_string
  from torch import nn
  from torch.nn import functional
  from .utils import lp_norm, powersum_norm
label_desc: Use image node_id 1 to create a new Regularizer object from inherited base classes: nn, ABC with example: obj = Regularizer(weight, apply_only_once, parameters)