Class: Gsplat::Autograd::Context
- Inherits:
-
Object
- Object
- Gsplat::Autograd::Context
- Defined in:
- lib/gsplat/autograd/context.rb
Overview
Per-operation values retained for the backward pass.
Instance Attribute Summary collapse
-
#inputs ⇒ Object
readonly
Returns the value of attribute inputs.
-
#needs_input_grad ⇒ Object
readonly
Returns the value of attribute needs_input_grad.
-
#saved_values ⇒ Object
readonly
Returns the value of attribute saved_values.
Instance Method Summary collapse
-
#clear ⇒ void
Releases references retained for backward.
-
#initialize(needs_input_grad, inputs = []) ⇒ Context
constructor
A new instance of Context.
-
#save(*values) ⇒ void
Saves values required by the operation's backward implementation.
Constructor Details
#initialize(needs_input_grad, inputs = []) ⇒ Context
Returns a new instance of Context.
16 17 18 19 20 |
# File 'lib/gsplat/autograd/context.rb', line 16 def initialize(needs_input_grad, inputs = []) @needs_input_grad = needs_input_grad.freeze @inputs = inputs @saved_values = [] end |
Instance Attribute Details
#inputs ⇒ Object (readonly)
Returns the value of attribute inputs.
12 13 14 |
# File 'lib/gsplat/autograd/context.rb', line 12 def inputs @inputs end |
#needs_input_grad ⇒ Object (readonly)
Returns the value of attribute needs_input_grad.
12 13 14 |
# File 'lib/gsplat/autograd/context.rb', line 12 def needs_input_grad @needs_input_grad end |
#saved_values ⇒ Object (readonly)
Returns the value of attribute saved_values.
12 13 14 |
# File 'lib/gsplat/autograd/context.rb', line 12 def saved_values @saved_values end |
Instance Method Details
#clear ⇒ void
This method returns an undefined value.
Releases references retained for backward.
33 34 35 36 |
# File 'lib/gsplat/autograd/context.rb', line 33 def clear @saved_values.clear @inputs = [] end |
#save(*values) ⇒ void
This method returns an undefined value.
Saves values required by the operation's backward implementation.
26 27 28 |
# File 'lib/gsplat/autograd/context.rb', line 26 def save(*values) @saved_values.concat(values) end |