Class: RubyZero::Core::Functions::Add
- Defined in:
- lib/rubyzero/core/functions/operators.rb
Instance Attribute Summary
Attributes inherited from Function
Instance Method Summary collapse
Methods inherited from Function
#call, #initialize, #inspect, plot
Constructor Details
This class inherits a constructor from RubyZero::Core::Functions::Function
Instance Method Details
#backward(dy) ⇒ Object
19 20 21 |
# File 'lib/rubyzero/core/functions/operators.rb', line 19 def backward(dy) return dy, dy end |
#forward(x1, x2) ⇒ Object
14 15 16 17 18 |
# File 'lib/rubyzero/core/functions/operators.rb', line 14 def forward(x1, x2) new_arr = x1.data + x2.data new_t = RubyZero::Core::Tensor.new(new_arr, device: x1.device) return new_t end |