Class: RubyZero::Core::Functions::Reshape
- Defined in:
- lib/rubyzero/core/functions/tensor_functions.rb
Instance Attribute Summary
Attributes inherited from Function
Instance Method Summary collapse
- #backward(dy) ⇒ Object
- #forward(x1) ⇒ Object
-
#initialize(shape) ⇒ Reshape
constructor
A new instance of Reshape.
Methods inherited from Function
Constructor Details
#initialize(shape) ⇒ Reshape
Returns a new instance of Reshape.
3 4 5 |
# File 'lib/rubyzero/core/functions/tensor_functions.rb', line 3 def initialize(shape) @dist_shape = shape end |
Instance Method Details
#backward(dy) ⇒ Object
12 13 14 |
# File 'lib/rubyzero/core/functions/tensor_functions.rb', line 12 def backward(dy) return [dy.reshape(@prev_shape)] end |