Class: DNN::Tensor
- Inherits:
-
Object
- Object
- DNN::Tensor
- Defined in:
- lib/dnn/core/tensor.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#link ⇒ Object
Returns the value of attribute link.
Class Method Summary collapse
Instance Method Summary collapse
- #*(other) ⇒ Object
- #**(index) ⇒ Object
- #+(other) ⇒ Object
- #+@ ⇒ Object
- #-(other) ⇒ Object
- #-@ ⇒ Object
- #/(other) ⇒ Object
-
#initialize(data, link = nil) ⇒ Tensor
constructor
A new instance of Tensor.
- #shape ⇒ Object
Constructor Details
#initialize(data, link = nil) ⇒ Tensor
Returns a new instance of Tensor.
14 15 16 17 |
# File 'lib/dnn/core/tensor.rb', line 14 def initialize(data, link = nil) @data = data @link = link end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/dnn/core/tensor.rb', line 3 def data @data end |
#link ⇒ Object
Returns the value of attribute link.
4 5 6 |
# File 'lib/dnn/core/tensor.rb', line 4 def link @link end |
Class Method Details
Instance Method Details
#*(other) ⇒ Object
39 40 41 |
# File 'lib/dnn/core/tensor.rb', line 39 def *(other) Layers::Mul.(self, other) end |
#**(index) ⇒ Object
47 48 49 |
# File 'lib/dnn/core/tensor.rb', line 47 def **(index) Layers::Pow.new(index).(self) end |
#+(other) ⇒ Object
31 32 33 |
# File 'lib/dnn/core/tensor.rb', line 31 def +(other) Layers::Add.(self, other) end |
#+@ ⇒ Object
23 24 25 |
# File 'lib/dnn/core/tensor.rb', line 23 def +@ self end |
#-(other) ⇒ Object
35 36 37 |
# File 'lib/dnn/core/tensor.rb', line 35 def -(other) Layers::Sub.(self, other) end |
#-@ ⇒ Object
27 28 29 |
# File 'lib/dnn/core/tensor.rb', line 27 def -@ self * -1 end |
#/(other) ⇒ Object
43 44 45 |
# File 'lib/dnn/core/tensor.rb', line 43 def /(other) Layers::Div.(self, other) end |
#shape ⇒ Object
19 20 21 |
# File 'lib/dnn/core/tensor.rb', line 19 def shape @data.shape end |