lib/torch.rb in torch-rb-0.13.2 vs lib/torch.rb in torch-rb-0.14.0

- old
+ new

@@ -385,11 +385,14 @@ def save(obj, f) File.binwrite(f, _save(to_ivalue(obj))) end - def load(f) - to_ruby(_load(File.binread(f))) + def load(filename) + # keep backwards compatibility + File.open(filename, "rb") { |f| f.read(1) } + + to_ruby(_load(filename)) end def tensor(data, **options) if options[:dtype].nil? && defined?(Numo::NArray) && data.is_a?(Numo::NArray) numo_to_dtype = _dtype_to_numo.map(&:reverse).to_h