Initial commit

This commit is contained in:
Kentaro Wada
2017-05-21 05:18:32 +09:00
commit 8ef5e28027
3 changed files with 119 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
# PyTorch for Numpy users
[PyTorch](https://github.com/pytorch/pytorch.git) version of [_Torch for Numpy users_](https://github.com/torch/torch7/wiki/Torch-for-Numpy-users).
## Types
| Numpy | PyTorch |
|:-------------|:---------------------|
| `np.uint8` | `torch.ByteTensor` |
| `np.int32` | `torch.IntTensor` |
| `np.int64` | `torch.LongTensor` |
| `np.float32` | `torch.FloatTensor` |
| `np.float64` | `torch.DoubleTensor` |
## Constructors
| Numpy | PyTorch |
|:-------------------|:---------------------------------------|
| `np.empty((2, 3))` | `torch.Tensor(2, 3)` |
| `np.empty_like(x)` | `x.new(x.size()).type(x.type())` |
| `np.eye` | `torch.eye` |
| `np.identity` | `torch.eye` |
| `np.ones` | `torch.ones` |
| `np.ones_like` | `torch.ones(x.size()).type(x.type())` |
| `np.zeros` | `torch.zeros` |
| `np.zeros_like` | `torch.zeros(x.size()).type(x.type())` |