Class: Candle::Tensor

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/candle/tensor.rb

Instance Method Summary collapse

Instance Method Details

#eachObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/candle/tensor.rb', line 5

def each
  if self.rank == 1
    self.values.each do |value|
      yield value
    end
  else
    shape.first.times do |i|
      yield self[i]
    end
  end
end