Shape ops
Unreleased native NuTorch shell reference. Generated by
scripts/gen-ops-reference.ts; every op also documents itself with
torch <op> --help. Tensor operands are native values, not strings.
cat
concatenate tensors along —dim (default 0)
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch cat <t1>... (at least 2) [--dim <Int>]
reshape
reshape to the given shape (-1 infers one dim)
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch reshape <t1> <shape>
permute
permute dimensions
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch permute <t1> <dims>
transpose
swap two dimensions
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch transpose <t1> <dim0> <dim1>
t
transpose a 2-D tensor
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch t <t1>
squeeze
drop size-1 dims (all, or —dim)
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch squeeze <t1> [--dim <Int>]
unsqueeze
insert a size-1 dim
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch unsqueeze <t1> <dim>
flatten
flatten dims (—start_dim/—end_dim)
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch flatten <t1> [--start_dim <Int>] [--end_dim <Int>]
stack
stack tensors along a NEW —dim (default 0)
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch stack <t1>... (at least 2) [--dim <Int>]
split
split into chunks of split_size along —dim
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch split <t1> <split_size> [--dim <Int>]
chunk
split into N chunks along —dim
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch chunk <t1> <chunks> [--dim <Int>]
gather
gather values along —dim using an int64 index tensor
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch gather <t1> <t2> [--dim <Int>]
index_select
select rows/cols along —dim by an int64 index tensor
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch index_select <t1> <t2> [--dim <Int>]
masked_select
select by mask (numeric mask cast via != 0, a NuTorch-ism)
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch masked_select <t1> <t2>
where
cond ? x : y (numeric cond cast via != 0, a NuTorch-ism)
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch where <t1> <t2> <t3>
narrow
slice: length elements from start along dim
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch narrow <t1> <dim> <start> <length>
flip
reverse along the given dims
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch flip <t1> <dims>
roll
roll elements by shifts (optionally along —dims)
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch roll <t1> <shifts> [--dims <IntList>]
repeat
tile the tensor by repeats per dim
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch repeat <t1> <repeats>
repeat_interleave
repeat each element N times (optionally along —dim)
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch repeat_interleave <t1> <repeats> [--dim <Int>]
movedim
move a dim to a new position
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch movedim <t1> <source> <destination>
take_along_dim
gather along —dim with a broadcastable int64 index
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch take_along_dim <t1> <t2> [--dim <Int>]
scatter
non-inplace scatter: input, int64 index, src along —dim
Signature (placeholders describe arguments; this is not a runnable example):
use torch
torch scatter <t1> <t2> <t3> [--dim <Int>]