lib/torch/inspector.rb in torch-rb-0.2.4 vs lib/torch/inspector.rb in torch-rb-0.2.5
- old
+ new
@@ -1,8 +1,8 @@
module Torch
module Inspector
- # TODO make more performance, especially when summarizing
+ # TODO make more performant, especially when summarizing
# how? only read data that will be displayed
def inspect
data =
if numel == 0
"[]"
@@ -12,10 +12,10 @@
summarize = numel > 1000
if dtype == :bool
fmt = "%s"
else
- values = to_a.flatten
+ values = _flat_data
abs = values.select { |v| v != 0 }.map(&:abs)
max = abs.max || 1
min = abs.min || 1
total = 0