class_docstr: A regularizer which formulates a soft constraint on a maximum norm.
class_docstr_tok: ["A","regularizer","which","formulates","a","soft","constraint","on","a","maximum","norm","."]
code: def forward(
      self, x: torch.FloatTensor
  ) -> torch.FloatTensor:  # noqa: D102
      if self.power_norm:
          norm = powersum_norm(
              x, p=self.p, dim=self.dim, normalize=False
          )
      else:
          norm = lp_norm(x=x, p=self.p, dim=self.dim, normalize=False)
      return (norm - self.max_norm).relu().sum()
  
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 2 for calling the NormLimitRegularizer obj's underlying member method code with example usage: obj.forward(x) and returns: unknown