ankane / torch.rb

Deep learning for Ruby, powered by LibTorch
Other
704 stars 30 forks source link

Missing bit shifts #29

Closed orlando-labs closed 2 years ago

orlando-labs commented 2 years ago

Hi, @ankane. Just found out there are no left/right bit shift methods. Python:

>>> import torch                                                                                                                                                                                                          
>>> torch.tensor([64]) >> 1                                                                                                                                                                                               
tensor([32])

Ruby:

3.0.0 :001 > require 'torch-rb'
 => true 
3.0.0 :002 > Torch.tensor([64]) >> 1
(irb):2:in `<main>': undefined method `>>' for tensor([64]):Torch::Tensor (NoMethodError)
Did you mean?  >

Can we do something with that? Thanks.

ankane commented 2 years ago

Added