braincore.math.clip_by_norm

Contents

braincore.math.clip_by_norm#

braincore.math.clip_by_norm(t, clip_norm, axis=None)#

Clip the tensor by the norm of the tensor.

Parameters:
  • t – The tensor to be clipped.

  • clip_norm – The maximum norm value.

  • axis – The axis to calculate the norm. If None, the norm is calculated over the whole tensor.

Returns:

The clipped tensor.