nn_utils_clip_grad_value_: Clips gradient of an iterable of parameters at specified...

View source: R/nn-utils-clip-grad.R

nn_utils_clip_grad_value_R Documentation

Clips gradient of an iterable of parameters at specified value.

Description

Gradients are modified in-place.

Usage

nn_utils_clip_grad_value_(parameters, clip_value)

Arguments

parameters

(Iterable(Tensor) or Tensor): an iterable of Tensors or a single Tensor that will have gradients normalized

clip_value

(float or int): maximum allowed value of the gradients.

Details

The gradients are clipped in the range \left[\mbox{-clip\_value}, \mbox{clip\_value}\right]


torch documentation built on June 7, 2023, 6:19 p.m.