README.md in torch-rb-0.1.2 vs README.md in torch-rb-0.1.3

- old
+ new

@@ -28,12 +28,14 @@ - Methods that return booleans use `?` instead of `is_` (`tensor?` instead of `is_tensor`) - Numo is used instead of NumPy (`x.numo` instead of `x.numpy()`) Many methods and options are missing at the moment. PRs welcome! -Some examples below are from [Deep Learning with PyTorch: A 60 Minutes Blitz](https://pytorch.org/tutorials/beginner/deep_learning_60min_blitz.html). +## Tutorial +Some examples below are from [Deep Learning with PyTorch: A 60 Minutes Blitz](https://pytorch.org/tutorials/beginner/deep_learning_60min_blitz.html) + ### Tensors Create a tensor from a Ruby array ```ruby @@ -143,11 +145,11 @@ Convert a Numo array to a tensor ```ruby b = Numo::NArray.cast([1, 2, 3]) -Torch.from_numpy(b) +Torch.from_numo(b) ``` ### Autograd Create a tensor with `requires_grad: true` @@ -178,14 +180,14 @@ Stop autograd from tracking history ```ruby x.requires_grad # true -(x ** 2).requires_grad # true +(x**2).requires_grad # true Torch.no_grad do - (x ** 2).requires_grad # false + (x**2).requires_grad # false end ``` ### Neural Networks @@ -357,10 +359,17 @@ ```ruby Torch.zeros(3) # tensor([0, 0, 0]) ``` +## Examples + +Here are a few full examples: + +- [Image classification with MNIST](examples/mnist) +- [Collaborative filtering with MovieLens](examples/movielens) + ## LibTorch Installation [Download LibTorch](https://pytorch.org/). For Linux, use the `cxx11 ABI` version. Then run: ```sh @@ -403,10 +412,10 @@ ```sh git clone https://github.com/ankane/torch-rb.git cd torch-rb bundle install -bundle exec rake compile +bundle exec rake compile -- --with-torch-dir=/path/to/libtorch bundle exec rake test ``` Here are some good resources for contributors: