mindformers.core.ClipGradNorm¶
- class mindformers.core.ClipGradNorm(max_norm=1.0, use_norm=None)[源代码]¶
Clips tensor values by the ratio of the sum of their norms.
- Args:
max_norm (Union(float, int)): The clipping ratio. Default: 1.0 use_norm (Union(float, None)): The global norm. Default: None
- Inputs:
x (Union(tuple[Tensor], list[Tensor])) - Input data to clip.
- Outputs:
Tensor, a clipped Tensor.