Class: Micrograd::AddOp
- Inherits:
-
Struct
- Object
- Struct
- Micrograd::AddOp
- Defined in:
- lib/micrograd/op.rb
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x
8 9 10 |
# File 'lib/micrograd/op.rb', line 8 def x @x end |
#y ⇒ Object
Returns the value of attribute y
8 9 10 |
# File 'lib/micrograd/op.rb', line 8 def y @y end |
Instance Method Details
#backward(value) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/micrograd/op.rb', line 9 def backward(value) x.grad += value.grad y.grad += value.grad x.backward y.backward end |