lib/torch/tensor.rb in torch-rb-0.9.0 vs lib/torch/tensor.rb in torch-rb-0.9.1

- old
+ new

@@ -104,10 +104,11 @@ # mirror Python len() def length size(0) end + remove_method :item def item if numel != 1 raise Error, "only one element tensors can be converted to Ruby scalars" end to_a.first @@ -131,18 +132,10 @@ cls = Torch._dtype_to_numo[dtype] raise Error, "Cannot convert #{dtype} to Numo" unless cls cls.from_string(_data_str).reshape(*shape) end - def new_ones(*size, **options) - Torch.ones_like(Torch.empty(*size), **options) - end - def requires_grad=(requires_grad) - _requires_grad!(requires_grad) - end - - def requires_grad!(requires_grad = true) _requires_grad!(requires_grad) end def type(dtype) if dtype.is_a?(Class)