lib/torch/tensor.rb in torch-rb-0.2.3 vs lib/torch/tensor.rb in torch-rb-0.2.4
- old
+ new
@@ -65,9 +65,17 @@
raise Error, "only one element tensors can be converted to Ruby scalars"
end
_flat_data.first
end
+ def to_i
+ item.to_i
+ end
+
+ def to_f
+ item.to_f
+ end
+
# unsure if this is correct
def new
Torch.empty(0, dtype: dtype)
end