Creation 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.

full

a tensor of the given shape filled with a value

Signature (placeholders describe arguments; this is not a runnable example):

use torch
torch full <shape> <value> [--dtype <Str>] [--requires_grad]

randn

standard-normal random tensor (float kinds only)

Signature (placeholders describe arguments; this is not a runnable example):

use torch
torch randn <shape> [--dtype <Str>] [--requires_grad]

zeros

a tensor of zeros

Signature (placeholders describe arguments; this is not a runnable example):

use torch
torch zeros <shape> [--dtype <Str>] [--requires_grad]

ones

a tensor of ones

Signature (placeholders describe arguments; this is not a runnable example):

use torch
torch ones <shape> [--dtype <Str>] [--requires_grad]

eye

identity matrix (n x n, or n x —m)

Signature (placeholders describe arguments; this is not a runnable example):

use torch
torch eye <n> [--m <Int>]

arange

range [—start, end) by —step

Signature (placeholders describe arguments; this is not a runnable example):

use torch
torch arange <end> [--start <Scalar>] [--step <Scalar>]

linspace

steps evenly spaced points in [start, end]

Signature (placeholders describe arguments; this is not a runnable example):

use torch
torch linspace <start> <end> <steps>

rand

uniform [0,1) random tensor (seeded CPU generator)

Signature (placeholders describe arguments; this is not a runnable example):

use torch
torch rand <shape> [--requires_grad]

randint

random int64s in [—low, high) (seeded CPU generator)

Signature (placeholders describe arguments; this is not a runnable example):

use torch
torch randint <high> <shape> [--low <Int>]

zeros_like

zeros with the input’s shape and dtype

Signature (placeholders describe arguments; this is not a runnable example):

use torch
torch zeros_like <t1>

ones_like

ones with the input’s shape and dtype

Signature (placeholders describe arguments; this is not a runnable example):

use torch
torch ones_like <t1>

full_like

a value-filled tensor with the input’s shape and dtype

Signature (placeholders describe arguments; this is not a runnable example):

use torch
torch full_like <t1> <value>

rand_like

uniform random with the input’s shape (seeded CPU generator)

Signature (placeholders describe arguments; this is not a runnable example):

use torch
torch rand_like <t1>

randn_like

normal random with the input’s shape (seeded CPU generator)

Signature (placeholders describe arguments; this is not a runnable example):

use torch
torch randn_like <t1>