README.md in torch-rb-0.1.0 vs README.md in torch-rb-0.1.1
- old
+ new
@@ -1,17 +1,19 @@
# Torch-rb
:fire: Deep learning for Ruby, powered by [LibTorch](https://pytorch.org)
-**Note:** This gem is currently experimental. There may be breaking changes between each release.
+This gem is currently experimental. There may be breaking changes between each release.
+[![Build Status](https://travis-ci.org/ankane/torch-rb.svg?branch=master)](https://travis-ci.org/ankane/torch-rb)
+
## Installation
First, [install LibTorch](#libtorch-installation). For Homebrew, use:
```sh
-brew install ankane/brew/libtorch
+brew install libtorch
```
Add this line to your application’s Gemfile:
```ruby
@@ -169,11 +171,11 @@
```
Get gradients
```ruby
-x.grad
+x.grad # tensor([[4.5, 4.5], [4.5, 4.5]])
```
Stop autograd from tracking history
```ruby
@@ -240,11 +242,11 @@
```
- `empty` returns a tensor with uninitialized values
```ruby
- Torch.empty(3)
+ Torch.empty(3) # tensor([7.0054e-45, 0.0000e+00, 0.0000e+00])
```
- `eye` returns an identity matrix
```ruby
@@ -276,23 +278,23 @@
```
- `rand` returns a tensor filled with values drawn from a uniform distribution on [0, 1)
```ruby
- Torch.rand(3)
+ Torch.rand(3) # tensor([0.5444, 0.8799, 0.5571])
```
- `randint` returns a tensor with integers randomly drawn from an interval
```ruby
- Torch.randint(1, 10, [3])
+ Torch.randint(1, 10, [3]) # tensor([7, 6, 4])
```
- `randn` returns a tensor filled with values drawn from a unit normal distribution
```ruby
- Torch.randn(3)
+ Torch.randn(3) # tensor([-0.7147, 0.6614, 1.1453])
```
- `randperm` returns a tensor filled with a random permutation of integers in some interval
```ruby
@@ -305,24 +307,24 @@
Torch.zeros(3) # tensor([0, 0, 0])
```
## LibTorch Installation
-[Download LibTorch](https://pytorch.org/) and run:
+[Download LibTorch](https://pytorch.org/). For Linux, use the `cxx11 ABI` version. Then run:
```sh
-gem install torch-rb -- --with-torch-dir=/path/to/libtorch
+bundle config build.torch-rb --with-torch-dir=/path/to/libtorch
```
### Homebrew
For Mac, you can use Homebrew.
```sh
-brew install ankane/brew/libtorch
+brew install libtorch
```
-Then install the gem (no need for `--with-torch-dir`).
+Then install the gem (no need for `bundle config`).
## rbenv
This library uses [Rice](https://github.com/jasonroelofs/rice) to interface with LibTorch. Rice and earlier versions of rbenv don’t play nicely together. If you encounter an error during installation, upgrade ruby-build and reinstall your Ruby version.