Num::Grad::Context(T)
Inherits Reference / Object
Constructors
Instance methods
last
Sourceno_grad
If no_grad is set to true, operations will not be cached, and backpropogation will not be possible
Creates a new variable within the Context. This variable
must be able to be cast to a Tensor of type T.
Arguments
- value :
Number-Numberto be monitored - requires_grad :
Bool- Flag to indicate if operations should be cached for this variable
Examples
ctx = Context(Tensor(Float64)).new
ctx.variable(3.0)
Creates a new variable within the Context. This variable
must be able to be cast to a Tensor of type T.
Arguments
- value :
Array-Arrayto be monitored - requires_grad :
Bool- Flag to indicate if operations should be cached for this variable
Examples
ctx = Context(Tensor(Float64)).new
ctx.variable([1.0, 2.0, 3.0])
Creates a new variable within the Context. This variable
must be able to be cast to a Tensor of type T.
Arguments
- value :
Tensor-Tensorto be monitored - requires_grad :
Bool- Flag to indicate if operations should be cached for this variable
Examples
ctx = Context(Tensor(Float64)).new
ctx.variable([1.0, 2.0, 3.0].to_tensor)