GradState

class GradState<T : DType, V>(var requiresGrad: Boolean = false, var grad: Tensor<T, V>? = null)(source)

Mutable holder for gradient state associated with a tensor instance.

Constructors

Link copied to clipboard
constructor(requiresGrad: Boolean = false, grad: Tensor<T, V>? = null)

Properties

Link copied to clipboard
var grad: Tensor<T, V>?
Link copied to clipboard

Functions

Link copied to clipboard
fun <T : DType, V> GradState<T, V>.accumulate(next: Tensor<T, V>)

Accumulate a gradient tensor onto this state.

Link copied to clipboard
fun <T : DType, V> GradState<T, V>.zero()

Clear the stored gradient.