Var

Var

Var is a type of variable for keeping gradients and a history of function calls.

Merlin.VarType.
Var

Variable struct.

Var contains the following members:

  • data

  • args

  • grad

Example

T = Float32
x = Var(rand(T,10,5)) # x.grad is set to `nothing`
x = zerograd(rand(T,10,5)) # x.grad is initialized as zero.
source
Merlin.gradient!Method.
gradient!(top::Var)

Compute gradients.

source
Merlin.isparamMethod.
isparam(x::Var)

Returns whether x is a parameter or not

source
Merlin.topsortMethod.
topsort(tops::T...)

Topological sort.

source