Class: Array
- Inherits:
-
Object
- Object
- Array
- Includes:
- TensorStream::MonkeyPatch, TensorStream::OpPatch
- Defined in:
- lib/tensor_stream/monkey_patches/array.rb
Instance Method Summary collapse
Methods included from TensorStream::OpPatch
Methods included from TensorStream::MonkeyPatch
Instance Method Details
#%(other) ⇒ Object
8 9 10 |
# File 'lib/tensor_stream/monkey_patches/array.rb', line 8 def %(other) TensorStream.convert_to_tensor(self) % other end |
#**(other) ⇒ Object
12 13 14 |
# File 'lib/tensor_stream/monkey_patches/array.rb', line 12 def **(other) TensorStream.convert_to_tensor(self)**other end |
#/(other) ⇒ Object
4 5 6 |
# File 'lib/tensor_stream/monkey_patches/array.rb', line 4 def /(other) TensorStream.convert_to_tensor(self) * other end |
#max_index ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/tensor_stream/monkey_patches/array.rb', line 16 def max_index if first.is_a?(Float) highest = first highest_index = 0 each_with_index do |item, index| next if item.nan? if item > highest highest = item highest_index = index end end highest_index else index(max) end end |
#min_index ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/tensor_stream/monkey_patches/array.rb', line 34 def min_index if first.is_a?(Float) highest = first highest_index = 0 each_with_index do |item, index| next if item.nan? if item < highest highest = item highest_index = index end end highest_index else index(min) end end |