diff options
| author | Yong He <yonghe@outlook.com> | 2023-04-11 18:24:43 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-11 18:24:43 -0700 |
| commit | 4e9ca28a71dca90e19a15b2103bdc3d0db6ffd9c (patch) | |
| tree | 09424517cbf103ed4f55fd627d4dbbff409fe544 | |
| parent | 195af97638e59539cd9c14d16338789b6d683f3f (diff) | |
Update documentation for `TorchTensor.alloc`.
| -rw-r--r-- | docs/user-guide/a1-02-slangpy.md | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/docs/user-guide/a1-02-slangpy.md b/docs/user-guide/a1-02-slangpy.md index dd218cd95..880db7ca6 100644 --- a/docs/user-guide/a1-02-slangpy.md +++ b/docs/user-guide/a1-02-slangpy.md @@ -409,7 +409,8 @@ Following is a list of builtin methods and attributes for PyTorch interop. ### `TorchTensor` methods #### `static TorchTensor<T> TorchTensor<T>.alloc(uint x, uint y, ...)` -Allocates a new PyTorch tensor with the given dimensions. +Allocates a new PyTorch tensor with the given dimensions. If `T` is a vector type, the length of the vector is implicitly included as the last dimension. +For example, `TorchTensor<float3>.alloc(4, 4)` allocates a 3D tensor of size `(4,4,3)`. #### `static TorchTensor<T> TorchTensor<T>.emptyLike(TorchTensor<T> other)` Allocates a new PyTorch tensor that has the same dimensions as `other` without initializing it. |
