捷徑

IR

PyTorch 2.0 為後端提供了兩組 IR 以供介接:Core Aten IR 和 Prims IR。

Core Aten IR

核心 aten 運算子是 aten 運算子的核心子集,可用於組合其他運算子。核心 aten IR 功能齊全,並且在此運算子集中沒有 inplace_out 變體。與 Prims IR 相反,核心 aten 運算子會重複使用「native_functions.yaml」中現有的 aten 運算子,並且不會進一步將運算子分解為明確的類型提升和廣播運算子。此運算子集旨在作為與後端介接的功能性 IR。

警告

此運算子集仍在積極開發中,未來將會新增更多運算子。

運算子

結構描述

aten._adaptive_avg_pool2d

_adaptive_avg_pool2d(Tensor self, SymInt[2] output_size) -> Tensor

aten._adaptive_avg_pool2d_backward

_adaptive_avg_pool2d_backward(Tensor grad_output, Tensor self) -> Tensor

aten._adaptive_avg_pool3d

_adaptive_avg_pool3d(Tensor self, SymInt[3] output_size) -> Tensor

aten._cdist_forward

_cdist_forward(Tensor x1, Tensor x2, float p, int? compute_mode) -> Tensor

aten._embedding_bag

_embedding_bag(Tensor weight, Tensor indices, Tensor offsets, bool scale_grad_by_freq=False, int mode=0, bool sparse=False, Tensor? per_sample_weights=None, bool include_last_offset=False, int padding_idx=-1) -> (Tensor, Tensor, Tensor, Tensor)

aten._local_scalar_dense

_local_scalar_dense(Tensor self) -> Scalar

aten._log_softmax

_log_softmax(Tensor self, int dim, bool half_to_float) -> Tensor

aten._native_batch_norm_legit

_native_batch_norm_legit(Tensor input, Tensor? weight, Tensor? bias, Tensor(a!) running_mean, Tensor(b!) running_var, bool training, float momentum, float eps) -> (Tensor, Tensor, Tensor)

aten._native_batch_norm_legit.no_stats

_native_batch_norm_legit.no_stats(Tensor input, Tensor? weight, Tensor? bias, bool training, float momentum, float eps) -> (Tensor, Tensor, Tensor)

aten._native_batch_norm_legit_no_training

_native_batch_norm_legit_no_training(Tensor input, Tensor? weight, Tensor? bias, Tensor running_mean, Tensor running_var, float momentum, float eps) -> (Tensor, Tensor, Tensor)

aten._pdist_forward

_pdist_forward(Tensor self, float p=2) -> Tensor

aten._softmax

_softmax(Tensor self, int dim, bool half_to_float) -> Tensor

aten._to_copy

_to_copy(Tensor self, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None, bool non_blocking=False, MemoryFormat? memory_format=None) -> Tensor

aten.abs

abs(Tensor self) -> Tensor

aten.acos

acos(Tensor self) -> Tensor

aten.acosh

acosh(Tensor self) -> Tensor

aten.adaptive_avg_pool1d

adaptive_avg_pool1d(Tensor self, int[1] output_size) -> Tensor

aten.add.Scalar

add.Scalar(Tensor self, Scalar other, Scalar alpha=1) -> Tensor

aten.add.Tensor

add.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor

aten.addmm

addmm(Tensor self, Tensor mat1, Tensor mat2, *, Scalar beta=1, Scalar alpha=1) -> Tensor

aten.alias

alias(Tensor(a) self) -> Tensor(a)

aten.amax

amax(Tensor self, int[1] dim=[], bool keepdim=False) -> Tensor

aten.amin

amin(Tensor self, int[1] dim=[], bool keepdim=False) -> Tensor

aten.any

any(Tensor self) -> Tensor

aten.any.dim

any.dim(Tensor self, int dim, bool keepdim=False) -> Tensor

aten.any.dims

any.dims(Tensor self, int[]? dim=None, bool keepdim=False) -> Tensor

aten.arange.start_step

arange.start_step(Scalar start, Scalar end, Scalar step=1, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor

aten.argmax

argmax(Tensor self, int? dim=None, bool keepdim=False) -> Tensor

aten.argmin

argmin(Tensor self, int? dim=None, bool keepdim=False) -> Tensor

aten.as_strided

as_strided(Tensor(a) self, SymInt[] size, SymInt[] stride, SymInt? storage_offset=None) -> Tensor(a)

aten.asin

asin(Tensor self) -> Tensor

aten.asinh

asinh(Tensor self) -> Tensor

aten.atan

atan(Tensor self) -> Tensor

aten.atan2

atan2(Tensor self, Tensor other) -> Tensor

aten.atan2.out

atan2.out(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)

aten.atanh

atanh(Tensor self) -> Tensor

aten.avg_pool1d

avg_pool1d(Tensor self, int[1] kernel_size, int[1] stride=[], int[1] padding=0, bool ceil_mode=False, bool count_include_pad=True) -> Tensor

aten.avg_pool2d

avg_pool2d(Tensor self, int[2] kernel_size, int[2] stride=[], int[2] padding=0, bool ceil_mode=False, bool count_include_pad=True, int? divisor_override=None) -> Tensor

aten.avg_pool2d_backward

avg_pool2d_backward(Tensor grad_output, Tensor self, int[2] kernel_size, int[2] stride, int[2] padding, bool ceil_mode, bool count_include_pad, int? divisor_override) -> Tensor

aten.avg_pool3d

avg_pool3d(Tensor self, int[3] kernel_size, int[3] stride=[], int[3] padding=0, bool ceil_mode=False, bool count_include_pad=True, int? divisor_override=None) -> Tensor

aten.bitwise_and.Scalar

bitwise_and.Scalar(Tensor self, Scalar other) -> Tensor

aten.bitwise_and.Tensor

bitwise_and.Tensor(Tensor self, Tensor other) -> Tensor

aten.bitwise_not

bitwise_not(Tensor self) -> Tensor

aten.bitwise_or.Scalar

bitwise_or.Scalar(Tensor self, Scalar other) -> Tensor

aten.bitwise_or.Tensor

bitwise_or.Tensor(Tensor self, Tensor other) -> Tensor

aten.bitwise_xor.Scalar

bitwise_xor.Scalar(Tensor self, Scalar other) -> Tensor

aten.bitwise_xor.Tensor

bitwise_xor.Tensor(Tensor self, Tensor other) -> Tensor

aten.bmm

bmm(Tensor self, Tensor mat2) -> Tensor

aten.cat

cat(Tensor[] tensors, int dim=0) -> Tensor

aten.ceil

ceil(Tensor self) -> Tensor

aten.clamp

clamp(Tensor self, Scalar? min=None, Scalar? max=None) -> Tensor

aten.clamp.Tensor

clamp.Tensor(Tensor self, Tensor? min=None, Tensor? max=None) -> Tensor

aten.clone

clone(Tensor self, *, MemoryFormat? memory_format=None) -> Tensor

aten.col2im

col2im(Tensor self, SymInt[2] output_size, int[2] kernel_size, int[2] dilation, int[2] padding, int[2] stride) -> Tensor

aten.constant_pad_nd

constant_pad_nd(Tensor self, SymInt[] pad, Scalar value=0) -> Tensor

aten.convolution

convolution(Tensor input, Tensor weight, Tensor? bias, SymInt[] stride, SymInt[] padding, SymInt[] dilation, bool transposed, SymInt[] output_padding, SymInt groups) -> Tensor

aten.convolution_backward

convolution_backward(Tensor grad_output, Tensor input, Tensor weight, SymInt[]? bias_sizes, SymInt[] stride, SymInt[] padding, SymInt[] dilation, bool transposed, SymInt[] output_padding, SymInt groups, bool[3] output_mask) -> (Tensor, Tensor, Tensor)

aten.copy

copy(Tensor self, Tensor src, bool non_blocking=False) -> Tensor

aten.cos

cos(Tensor self) -> Tensor

aten.cosh

cosh(Tensor self) -> Tensor

aten.cumsum

cumsum(Tensor self, int dim, *, ScalarType? dtype=None) -> Tensor

aten.diagonal

diagonal(Tensor(a) self, int offset=0, int dim1=0, int dim2=1) -> Tensor(a)

aten.div.Scalar

div.Scalar(Tensor self, Scalar other) -> Tensor

aten.div.Scalar_mode

div.Scalar_mode(Tensor self, Scalar other, *, str? rounding_mode) -> Tensor

aten.div.Tensor

div.Tensor(Tensor self, Tensor other) -> Tensor

aten.div.Tensor_mode

div.Tensor_mode(Tensor self, Tensor other, *, str? rounding_mode) -> Tensor

aten.embedding

embedding(Tensor weight, Tensor indices, SymInt padding_idx=-1, bool scale_grad_by_freq=False, bool sparse=False) -> Tensor

aten.embedding_dense_backward

embedding_dense_backward(Tensor grad_output, Tensor indices, SymInt num_weights, SymInt padding_idx, bool scale_grad_by_freq) -> Tensor

aten.empty.memory_format

empty.memory_format(SymInt[] size, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None, MemoryFormat? memory_format=None) -> Tensor

aten.empty_strided

empty_strided(SymInt[] size, SymInt[] stride, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor

aten.eq.Scalar

eq.Scalar(Tensor self, Scalar other) -> Tensor

aten.eq.Tensor

eq.Tensor(Tensor self, Tensor other) -> Tensor

aten.erf

erf(Tensor self) -> Tensor

aten.exp

exp(Tensor self) -> Tensor

aten.expand

expand(Tensor(a) self, SymInt[] size, *, bool implicit=False) -> Tensor(a)

aten.expm1

expm1(Tensor self) -> Tensor

aten.fill.Scalar

fill.Scalar(Tensor self, Scalar value) -> Tensor

aten.flip

flip(Tensor self, int[] dims) -> Tensor

aten.floor

floor(Tensor self) -> Tensor

aten.fmod.Scalar

fmod.Scalar(Tensor self, Scalar other) -> Tensor

aten.fmod.Tensor

fmod.Tensor(Tensor self, Tensor other) -> Tensor

aten.full

full(SymInt[] size, Scalar fill_value, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor

aten.gather

gather(Tensor self, int dim, Tensor index, *, bool sparse_grad=False) -> Tensor

aten.ge.Scalar

ge.Scalar(Tensor self, Scalar other) -> Tensor

aten.ge.Tensor

ge.Tensor(Tensor self, Tensor other) -> Tensor

aten.gelu

gelu(Tensor self, *, str approximate=’none’) -> Tensor

aten.grid_sampler_2d

grid_sampler_2d(Tensor input, Tensor grid, int interpolation_mode, int padding_mode, bool align_corners) -> Tensor

aten.gt.Scalar

gt.Scalar(Tensor self, Scalar other) -> Tensor

aten.gt.Tensor

gt.Tensor(Tensor self, Tensor other) -> Tensor

aten.hardtanh

hardtanh(Tensor self, Scalar min_val=-1, Scalar max_val=1) -> Tensor

aten.index.Tensor

index.Tensor(Tensor self, Tensor?[] indices) -> Tensor

aten.index_put

index_put(Tensor self, Tensor?[] indices, Tensor values, bool accumulate=False) -> Tensor

aten.index_select

index_select(Tensor self, int dim, Tensor index) -> Tensor

aten.isinf

isinf(Tensor self) -> Tensor

aten.isnan

isnan(Tensor self) -> Tensor

aten.le.Scalar

le.Scalar(Tensor self, Scalar other) -> Tensor

aten.le.Tensor

le.Tensor(Tensor self, Tensor other) -> Tensor

aten.leaky_relu

leaky_relu(Tensor self, Scalar negative_slope=0.01) -> Tensor

aten.log

log(Tensor self) -> Tensor

aten.log10

log10(Tensor self) -> Tensor

aten.log1p

log1p(Tensor self) -> Tensor

aten.log2

log2(Tensor self) -> Tensor

aten.logical_and

logical_and(Tensor self, Tensor other) -> Tensor

aten.logical_not

logical_not(Tensor self) -> Tensor

aten.logical_or

logical_or(Tensor self, Tensor other) -> Tensor

aten.logical_xor

logical_xor(Tensor self, Tensor other) -> Tensor

aten.lt.Scalar

lt.Scalar(Tensor self, Scalar other) -> Tensor

aten.lt.Tensor

lt.Tensor(Tensor self, Tensor other) -> Tensor

aten.max.dim

max.dim(Tensor self, int dim, bool keepdim=False) -> (Tensor values, Tensor indices)

aten.max_pool2d_with_indices

max_pool2d_with_indices(Tensor self, int[2] kernel_size, int[2] stride=[], int[2] padding=0, int[2] dilation=1, bool ceil_mode=False) -> (Tensor, Tensor)

aten.max_pool2d_with_indices_backward

max_pool2d_with_indices_backward(Tensor grad_output, Tensor self, int[2] kernel_size, int[2] stride, int[2] padding, int[2] dilation, bool ceil_mode, Tensor indices) -> Tensor

aten.max_pool3d_with_indices

max_pool3d_with_indices(Tensor self, int[3] kernel_size, int[3] stride=[], int[3] padding=0, int[3] dilation=1, bool ceil_mode=False) -> (Tensor, Tensor)

aten.maximum

maximum(Tensor self, Tensor other) -> Tensor

aten.mean

mean(Tensor self, *, ScalarType? dtype=None) -> Tensor

aten.mean.dim

mean.dim(Tensor self, int[1]? dim, bool keepdim=False, *, ScalarType? dtype=None) -> Tensor

aten.min.dim

min.dim(Tensor self, int dim, bool keepdim=False) -> (Tensor values, Tensor indices)

aten.minimum

minimum(Tensor self, Tensor other) -> Tensor

aten.mm

mm(Tensor self, Tensor mat2) -> Tensor

aten.mul.Scalar

mul.Scalar(Tensor self, Scalar other) -> Tensor

aten.mul.Tensor

mul.Tensor(Tensor self, Tensor other) -> Tensor

aten.native_dropout

native_dropout(Tensor input, float p, bool? train) -> (Tensor, Tensor)

aten.native_group_norm

native_group_norm(Tensor input, Tensor? weight, Tensor? bias, SymInt N, SymInt C, SymInt HxW, int group, float eps) -> (Tensor, Tensor, Tensor)

aten.native_group_norm_backward

native_group_norm_backward(Tensor grad_out, Tensor input, Tensor mean, Tensor rstd, Tensor? weight, SymInt N, SymInt C, SymInt HxW, int group, bool[3] output_mask) -> (Tensor, Tensor, Tensor)

aten.native_layer_norm

native_layer_norm(Tensor input, SymInt[] normalized_shape, Tensor? weight, Tensor? bias, float eps) -> (Tensor, Tensor, Tensor)

aten.native_layer_norm_backward

native_layer_norm_backward(Tensor grad_out, Tensor input, SymInt[] normalized_shape, Tensor mean, Tensor rstd, Tensor? weight, Tensor? bias, bool[3] output_mask) -> (Tensor, Tensor, Tensor)

aten.ne.Scalar

ne.Scalar(Tensor self, Scalar other) -> Tensor

aten.ne.Tensor

ne.Tensor(Tensor self, Tensor other) -> Tensor

aten.neg

neg(Tensor self) -> Tensor

aten.nonzero

nonzero(Tensor self) -> Tensor

aten.permute

permute(Tensor(a) self, int[] dims) -> Tensor(a)

aten.pow.Scalar

pow.Scalar(Scalar self, Tensor exponent) -> Tensor

aten.pow.Tensor_Scalar

pow.Tensor_Scalar(Tensor self, Scalar exponent) -> Tensor

aten.pow.Tensor_Tensor

pow.Tensor_Tensor(Tensor self, Tensor exponent) -> Tensor

aten.prod

prod(Tensor self, *, ScalarType? dtype=None) -> Tensor

aten.prod.dim_int

prod.dim_int(Tensor self, int dim, bool keepdim=False, *, ScalarType? dtype=None) -> Tensor

aten.rand

rand(SymInt[] size, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor

aten.randn

randn(SymInt[] size, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor

aten.randperm

randperm(SymInt n, *, ScalarType? dtype=long, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor

aten.reciprocal

reciprocal(Tensor self) -> Tensor

aten.reflection_pad1d

reflection_pad1d(Tensor self, SymInt[2] padding) -> Tensor

aten.reflection_pad2d

reflection_pad2d(Tensor self, SymInt[4] padding) -> Tensor

aten.reflection_pad3d

reflection_pad3d(Tensor self, SymInt[6] padding) -> Tensor

aten.relu

relu(Tensor self) -> Tensor

aten.remainder.Scalar

remainder.Scalar(Tensor self, Scalar other) -> Tensor

aten.remainder.Tensor

remainder.Tensor(Tensor self, Tensor other) -> Tensor

aten.repeat

repeat(Tensor self, SymInt[] repeats) -> Tensor

aten.replication_pad2d

replication_pad2d(Tensor self, SymInt[4] padding) -> Tensor

aten.replication_pad3d

replication_pad3d(Tensor self, SymInt[6] padding) -> Tensor

aten.resize_

resize_(Tensor(a!) self, SymInt[] size, *, MemoryFormat? memory_format=None) -> Tensor(a!)

aten.round

round(Tensor self) -> Tensor

aten.rsqrt

rsqrt(Tensor self) -> Tensor

aten.scalar_tensor

scalar_tensor(Scalar s, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor

aten.scatter.src

scatter.src(Tensor self, int dim, Tensor index, Tensor src) -> Tensor

aten.scatter.value

scatter.value(Tensor self, int dim, Tensor index, Scalar value) -> Tensor

aten.scatter_add

scatter_add(Tensor self, int dim, Tensor index, Tensor src) -> Tensor

aten.scatter_reduce.two

scatter_reduce.two(Tensor self, int dim, Tensor index, Tensor src, str reduce, *, bool include_self=True) -> Tensor

aten.select.int

select.int(Tensor(a) self, int dim, SymInt index) -> Tensor(a)

aten.select_scatter

select_scatter(Tensor self, Tensor src, int dim, SymInt index) -> Tensor

aten.sigmoid

sigmoid(Tensor self) -> Tensor

aten.sign

sign(Tensor self) -> Tensor

aten.sin

sin(Tensor self) -> Tensor

aten.sinh

sinh(Tensor self) -> Tensor

aten.slice.Tensor

slice.Tensor(Tensor(a) self, int dim=0, SymInt? start=None, SymInt? end=None, SymInt step=1) -> Tensor(a)

aten.slice_scatter

slice_scatter(Tensor self, Tensor src, int dim=0, SymInt? start=None, SymInt? end=None, SymInt step=1) -> Tensor

aten.sort

sort(Tensor self, int dim=-1, bool descending=False) -> (Tensor values, Tensor indices)

aten.split_with_sizes

split_with_sizes(Tensor(a -> *) self, SymInt[] split_sizes, int dim=0) -> Tensor(a)[]

aten.sqrt

sqrt(Tensor self) -> Tensor

aten.squeeze.dim

squeeze.dim(Tensor(a) self, int dim) -> Tensor(a)

aten.squeeze.dims

squeeze.dims(Tensor(a) self, int[] dim) -> Tensor(a)

aten.sub.Scalar

sub.Scalar(Tensor self, Scalar other, Scalar alpha=1) -> Tensor

aten.sub.Tensor

sub.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor

aten.sum.dim_IntList

sum.dim_IntList(Tensor self, int[1]? dim, bool keepdim=False, *, ScalarType? dtype=None) -> Tensor

aten.sym_numel

sym_numel(Tensor self) -> SymInt

aten.sym_size.int

sym_size.int(Tensor self, int dim) -> SymInt

aten.sym_storage_offset

sym_storage_offset(Tensor self) -> SymInt

aten.sym_stride.int

sym_stride.int(Tensor self, int dim) -> SymInt

aten.tan

tan(Tensor self) -> Tensor

aten.tanh

tanh(Tensor self) -> Tensor

aten.topk

topk(Tensor self, SymInt k, int dim=-1, bool largest=True, bool sorted=True) -> (Tensor values, Tensor indices)

aten.trunc

trunc(Tensor self) -> Tensor

aten.unsqueeze

unsqueeze(Tensor(a) self, int dim) -> Tensor(a)

aten.upsample_bilinear2d.vec

upsample_bilinear2d.vec(Tensor input, SymInt[]? output_size, bool align_corners, float[]? scale_factors) -> Tensor

aten.upsample_nearest2d.vec

upsample_nearest2d.vec(Tensor input, SymInt[]? output_size, float[]? scale_factors) -> Tensor

aten.var.correction

var.correction(Tensor self, int[1]? dim=None, *, Scalar? correction=None, bool keepdim=False) -> Tensor

aten.var.dim

var.dim(Tensor self, int[1]? dim, bool unbiased=True, bool keepdim=False) -> Tensor

aten.view

view(Tensor(a) self, SymInt[] size) -> Tensor(a)

aten.where.self

where.self(張量 condition, 張量 self, 張量 other) -> 張量

Prims IR

Prims IR 是一組可用於組合其他運算子的基本運算子。Prims IR 是比核心 Aten IR 更低階的運算子集,它將運算子進一步分解為明確的類型提升和廣播運算子:prims.convert_element_type 和 prims.broadcast_in_dim。此運算子集旨在與編譯器後端介接。

警告

此運算子集仍在積極開發中,未來將會新增更多運算子。

運算子

結構描述

prims.abs

(張量 self) -> 張量

prims.acos

(張量 self) -> 張量

prims.acosh

(張量 self) -> 張量

prims.asin

(張量 self) -> 張量

prims.asinh

(張量 self) -> 張量

prims.atan

(張量 self) -> 張量

prims.atanh

(張量 self) -> 張量

prims.cos

(張量 self) -> 張量

prims.cosh

(張量 self) -> 張量

prims.bessel_i0

(張量 self) -> 張量

prims.bessel_i0e

(張量 self) -> 張量

prims.bessel_i1

(張量 self) -> 張量

prims.bessel_i1e

(張量 self) -> 張量

prims.bessel_j0

(張量 self) -> 張量

prims.bessel_j1

(張量 self) -> 張量

prims.bitwise_not

(張量 self) -> 張量

prims.cbrt

(張量 self) -> 張量

prims.ceil

(張量 self) -> 張量

prims.conj_physical

(張量 self) -> 張量

prims.digamma

(張量 self) -> 張量

prims.erf

(張量 self) -> 張量

prims.erf_inv

(張量 self) -> 張量

prims.erfc

(張量 self) -> 張量

prims.erfcx

(張量 self) -> 張量

prims.exp

(張量 self) -> 張量

prims.expm1

(張量 self) -> 張量

prims.exp2

(張量 self) -> 張量

prims.fill

(張量 self, 純量 value) -> 張量

prims.floor

(張量 self) -> 張量

prims.imag

(張量(a) self) -> 張量(a)

prims.isfinite

(張量 self) -> 張量

prims.lgamma

(張量 self) -> 張量

prims.log

(張量 self) -> 張量

prims.log1p

(張量 self) -> 張量

prims.log2

(張量 self) -> 張量

prims.log10

(張量 self) -> 張量

prims.ndtri

(張量 self) -> 張量

prims.neg

(張量 self) -> 張量

prims.real

(張量(a) self) -> 張量(a)

prims.reciprocal

(張量 self) -> 張量

prims.round

(張量 self) -> 張量

prims.sign

(張量 self) -> 張量

prims.signbit

(張量 self) -> 張量

prims.sin

(張量 self) -> 張量

prims.sinh

(張量 self) -> 張量

prims.spherical_bessel_j0

(張量 self) -> 張量

prims.sqrt

(張量 self) -> 張量

prims.tan

(張量 self) -> 張量

prims.tanh

(張量 self) -> 張量

prims.trunc

(張量 self) -> 張量

prims.add

(張量 self, 張量 other) -> 張量

prims.atan2

(張量 self, 張量 other) -> 張量

prims.bitwise_and

(張量 self, 張量 other) -> 張量

prims.bitwise_or

(張量 self, 張量 other) -> 張量

prims.bitwise_xor

(張量 self, 張量 other) -> 張量

prims.div

(張量 self, 張量 other) -> 張量

prims.eq

(張量 self, 張量 other) -> 張量

prims.fmax

(張量 self, 張量 other) -> 張量

prims.fmin

(張量 self, 張量 other) -> 張量

prims.fmod

(張量 self, 張量 other) -> 張量

prims.frexp

(張量 self) -> (張量 mantissa, 張量 exponent)

prims.gcd

(張量 self, 張量 other) -> 張量

prims.ge

(張量 self, 張量 other) -> 張量

prims.gt

(張量 self, 張量 other) -> 張量

prims.hypot

(張量 self, 張量 other) -> 張量

prims.igamma

(張量 self, 張量 other) -> 張量

prims.igammac

(張量 self, 張量 other) -> 張量

prims.le

(張量 self, 張量 other) -> 張量

prims.lt

(張量 self, 張量 other) -> 張量

prims.maximum

(張量 self, 張量 other) -> 張量

prims.minimum

(張量 self, 張量 other) -> 張量

prims.mul

(張量 self, 張量 other) -> 張量

prims.ne

(張量 self, 張量 other) -> 張量

prims.nextafter

(張量 self, 張量 other) -> 張量

prims.pow

(張量 self, 張量 other) -> 張量

prims.remainder

(張量 self, 張量 other) -> 張量

prims.rsqrt

(張量 self) -> 張量

prims.shift_left

(張量 self, 張量 other) -> 張量

prims.shift_right_arithmetic

(張量 self, 張量 other) -> 張量

prims.sub

(張量 self, 張量 other) -> 張量

prims.zeta

(張量 self, 張量 other) -> 張量

prims.as_strided

(張量(a!) a, 符號整數[] size, 符號整數[] stride, 符號整數 storage_offset) -> 張量(a!)

prims.broadcast_in_dim

(張量(a) a, 符號整數[] shape, 整數[] broadcast_dimensions) -> 張量(a)

prims.collapse_view

(張量(a) a, 整數 start, 整數 end) -> 張量(a)

prims.conj

(張量(a) a) -> 張量(a)

prims.slice

(張量(a) a, 符號整數[] start_indices, 符號整數[] limit_indices, 符號整數[]? strides=無) -> 張量(a)

prims.slice_in_dim

(張量(a) a, 符號整數 start_index, 符號整數 limit_index, 整數 stride=1, 整數 axis=0) -> 張量(a)

prims.split_dim

(張量(a) a, 整數 dim, 符號整數 outer_length) -> 張量(a)

prims.squeeze

(張量(a) a, 整數[] dimensions) -> 張量(a)

prims.transpose

(張量(a) a, 整數[] permutation) -> 張量(a)

prims.view_of

(張量(a) a) -> 張量(a)

prims.view_of_dtype

(張量(a) a, 純量類型 dtype) -> 張量(a)

prims.as_strided_scatter

(張量 self, 張量 src, 符號整數[] size, 符號整數[] stride, 符號整數 storage_offset) -> 張量

prims.collapse

(張量 a, 整數 start, 整數 end) -> 張量

prims.cat

(張量[] tensors, 整數 dim) -> 張量

prims.reshape

(張量 a, 符號整數[] shape) -> 張量

prims.rev

(張量 a, 整數[] dims) -> 張量

prims.where

(張量 pred, 張量 a, 張量 b) -> 張量

prims.clone

(張量 self, *, 記憶體格式? memory_format=無) -> 張量

prims.convert_element_type

(張量 a, 純量類型 dtype) -> 張量

prims.device_put

(張量 a, 裝置 device) -> 張量

prims.item

(張量 a) -> 純量

prims.maximum_value

(純量類型 dtype) -> 純量

prims.minimum_value

(純量類型 dtype) -> 純量

prims.copy_strided

(張量 a, 符號整數[] stride) -> 張量

prims.copy_to

(張量(a!) a, 張量 b) -> 張量(a!)

prims.resize

(張量(a!) a, 符號整數[] shape) -> 張量(a!)

prims.amax

(張量 inp, 整數[]? dims, *, 純量類型? output_dtype=無) -> 張量

prims.amin

(張量 inp, 整數[]? dims, *, 純量類型? output_dtype=無) -> 張量

prims.prod

(張量 inp, 整數[]? dims, *, 純量類型? output_dtype=無) -> 張量

prims.sum

(張量 inp, 整數[]? dims, *, 純量類型? output_dtype=無) -> 張量

prims.xor_sum

(張量 inp, 整數[]? dims, *, 純量類型? output_dtype=無) -> 張量

prims.var

(張量 inp, 整數[]? dims, 浮點數? correction=1, *, 純量類型? output_dtype=無) -> 張量

prims.empty_strided

(符號整數[] shape, 符號整數[] strides, *, 純量類型 dtype, 裝置 device, 布林值 requires_grad) -> 張量

prims.empty_permuted

(符號整數[] shape, 整數[] physical_layout, *, 純量類型 dtype, 裝置 device, 布林值 requires_grad) -> 張量

prims.scalar_tensor

(純量 s, *, 純量類型? dtype=無, 裝置? device=無) -> 張量

prims.iota

(符號整數 length, *, 符號整數 start, 符號整數 step, 純量類型 dtype, 裝置 device, 布林值 requires_grad) -> 張量

prims.svd

(張量 A, *, 布林值 full_matrices) -> (張量 U, 張量 S, 張量 Vh)

prims.normal

(符號整數[] shape, *, 純量 mean, 純量 std, 純量類型 dtype, 裝置 device, 布林值 requires_grad, 產生器? generator=無) -> 張量

prims.uniform

(符號整數[] shape, *, 純量 low, 純量 high, 純量類型 dtype, 裝置 device, 產生器? generator=無) -> 張量

prims.fft_r2c

(張量 self, *, 整數[] dim, 布林值 onesided) -> 張量

prims.fft_c2c

(張量 self, *, 整數[] dim, 布林值 forward) -> 張量

prims.fft_c2r

(張量 self, *, 整數[] dim, 符號整數 last_dim_size) -> 張量

prims._make_token

() -> 張量

prims._sink_tokens

(張量[] tokens) -> ()

文件

存取 PyTorch 的完整開發人員文件

檢視文件

教學課程

取得適用於初學者和進階開發人員的深入教學課程

檢視教學課程

資源

尋找開發資源並取得問題解答

檢視資源