IRs¶
PyTorch 2.0 为后端提供了两组 IR 接口:Core Aten IR 和 Prims IR。
Core Aten IR¶
Core aten ops 是 aten 运算符的核心子集,可用于组合其他运算符。 Core aten IR 功能齐全,此 opset 中没有 inplace 或 _out 变体。 与 Prims IR 相比,核心 aten ops 重用了 “native_functions.yaml” 中现有的 aten ops。 它没有进一步将 Ops 分解为 Explicit type Promote 和 Broadcast Ops。 此 opset 旨在用作与后端接口的功能性 IR。
警告
此 opset 仍在积极开发中,未来将添加更多 ops。
算子 |
图式 |
---|---|
|
_adaptive_avg_pool2d(Tensor self, SymInt[2] output_size) -> 张量 |
|
_adaptive_avg_pool2d_backward(Tensor grad_output, Tensor self) -> Tensor |
|
_log_softmax(Tensor self, int dim, bool half_to_float) -> 张量 |
|
_native_batch_norm_legit.no_stats(张量输入、张量权重、张量偏差、布尔训练、浮点动量、浮点 eps) -> (张量、张量、张量) |
|
_softmax(Tensor self, int dim, bool half_to_float) -> 张量 |
|
_to_copy(Tensor self, *, ScalarType? dtype=无, 布局? layout=无, device? device=无, bool? pin_memory=无, bool non_blocking=False, MemoryFormat memory_format=无) -> 张量 |
|
abs(Tensor self) -> 张量 |
|
acos(Tensor self) -> 张量 |
|
acosh(Tensor self) -> 张量 |
|
加。Scalar(Tensor self, Scalar other, Scalar alpha=1) -> 张量 |
|
加。Tensor(Tensor self, Tensor other, *, 标量 alpha=1) -> 张量 |
|
addmm(张量 self, 张量 mat1, 张量 mat2, *, 标量 beta=1, 标量 alpha=1) -> 张量 |
|
别名(张量(a) self) -> 张量(a) |
|
amax(Tensor self, int[1] dim=[], bool keepdim=False) -> 张量 |
|
amin(Tensor self, int[1] dim=[], bool keepdim=False) -> 张量 |
|
arange.start_step(标量开始,标量结束,标量步长=1, *, ScalarType? dtype=无, 布局? layout=无, 设备? device=无, bool? pin_memory=无) -> 张量 |
|
argmax(Tensor self, int? dim=None, bool keepdim=False) -> 张量 |
|
argmin(Tensor self, int? dim=None, bool keepdim=False) -> 张量 |
|
as_strided(Tensor(a) self, SymInt[] 大小, SymInt[] 步幅, SymInt storage_offset=无) -> 张量 (a) |
|
asin(Tensor self) -> 张量 |
|
asinh(Tensor self) -> Tensor |
|
atan(Tensor self) -> 张量 |
|
atanh(Tensor self) -> 张量 |
|
avg_pool2d(张量 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) -> 张量 |
|
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) -> 张量 |
|
bitwise_and。Tensor(Tensor self, Tensor other) -> Tensor |
|
bitwise_not(Tensor self) -> 张量 |
|
bitwise_or。Tensor(Tensor self, Tensor other) -> Tensor |
|
bitwise_xor。Tensor(Tensor self, Tensor other) -> Tensor |
|
bmm(Tensor self, Tensor mat2) -> 张量 |
|
cat(Tensor[] 张量, int dim=0) -> 张量 |
|
clamp(Tensor self, Scalar? min=None, Scalar? max=None) -> 张量 |
|
clone(Tensor self, *, MemoryFormat? memory_format=None) -> 张量 |
|
col2im(张量 self, SymInt[2] output_size, int[2] kernel_size, int[2] 膨胀, int[2] 填充, int[2] 步幅) -> 张量 |
|
constant_pad_nd(Tensor self, SymInt[] pad, 标量值=0) -> 张量 |
|
convolution(张量输入、张量权重、张量?偏差、int[] 步幅、SymInt[] 填充、int[] 膨胀、bool 转置、SymInt[] output_padding、int 组) -> 张量 |
|
convolution_backward(张量grad_output, 张量输入, 张量权重, SymInt[]? bias_sizes, int[] 步幅, SymInt[] 填充, int[] 膨胀, bool 转置, SymInt[] output_padding, int 组, bool[3] output_mask) -> (张量, 张量, 张量) |
|
cos(Tensor self) -> 张量 |
|
cosh(Tensor self) -> 张量 |
|
div.Scalar(Tensor self, Scalar other) -> Tensor |
|
div.Tensor(Tensor self, Tensor other) -> Tensor |
|
embedding_dense_backward(Tensor grad_output, Tensor indices, SymInt num_weights, SymInt padding_idx, bool scale_grad_by_freq) -> 张量 |
|
empty_strided(SymInt[] 大小, SymInt[] 步幅, *, ScalarType? dtype=无, 布局? layout=无, 设备? device=无, bool? pin_memory=无) -> 张量 |
|
情 商。Scalar(Tensor self, Scalar other) -> 张量 |
|
情 商。Tensor(Tensor self, Tensor other) -> Tensor |
|
erf(Tensor self) -> Tensor |
|
exp(Tensor self) -> 张量 |
|
expand(Tensor(a) self, SymInt[] 大小, *, bool implicit=False) -> Tensor(a) |
|
填补。Scalar(Tensor self, Scalar value) -> 张量 |
|
flip(Tensor self, int[] dims) -> 张量 |
|
floor(Tensor self) -> 张量 |
|
fmod 的Tensor(Tensor self, Tensor other) -> Tensor |
|
full(SymInt[] 大小, 标量fill_value, *, ScalarType? dtype=无, 布局? layout=无, 设备? device=无, bool? pin_memory=无) -> 张量 |
|
gather(Tensor self, int dim, Tensor index, *, bool sparse_grad=False) -> 张量 |
|
通用 电气。Scalar(Tensor self, Scalar other) -> 张量 |
|
通用 电气。Tensor(Tensor self, Tensor other) -> Tensor |
|
gelu(Tensor self, *, str approximate='none') -> 张量 |
|
grid_sampler_2d(Tensor input, Tensor grid, int interpolation_mode, int padding_mode, bool align_corners) -> 张量 |
|
燃气轮机。Scalar(Tensor self, Scalar other) -> 张量 |
|
燃气轮机。Tensor(Tensor self, Tensor other) -> Tensor |
|
hardtanh(张量 self, 标量 min_val=-1, 标量 max_val=1) -> 张量 |
|
index_select(Tensor self, int dim, Tensor index) -> 张量 |
|
isinf(Tensor self) -> 张量 |
|
isnan(Tensor self) -> 张量 |
|
乐。Scalar(Tensor self, Scalar other) -> 张量 |
|
乐。Tensor(Tensor self, Tensor other) -> Tensor |
|
leaky_relu(Tensor self, Scalar negative_slope=0.01) -> 张量 |
|
log(Tensor self) -> Tensor |
|
logical_and(Tensor self, Tensor other) -> 张量 |
|
logical_not(Tensor self) -> 张量 |
|
logical_or(Tensor self, Tensor other) -> 张量 |
|
中尉。Scalar(Tensor self, Scalar other) -> 张量 |
|
中尉。Tensor(Tensor self, Tensor other) -> Tensor |
|
max.dim (张量 self, int dim, bool keepdim=False) -> (张量值, 张量索引) |
|
max_pool2d_with_indices(张量 self, int[2] kernel_size, int[2] stride=[], int[2] padding=0, int[2] dilation=1, bool ceil_mode=False) -> (张量, 张量) |
|
max_pool2d_with_indices_backward(张量grad_output、张量自身、int[2] kernel_size、int[2] 步幅、int[2] 填充、int[2] 膨胀、bool ceil_mode、张量索引) -> 张量 |
|
max_pool3d_with_indices(张量 self, int[3] kernel_size, int[3] stride=[], int[3] padding=0, int[3] dilation=1, bool ceil_mode=False) -> (张量, 张量) |
|
maximum(Tensor self, Tensor other) -> 张量 |
|
mean.dim(Tensor self, int[1]? dim, bool keepdim=False, *, ScalarType? dtype=None) -> 张量 |
|
min.dim(张量 self, int dim, bool keepdim=False) -> (张量值, 张量索引) |
|
minimum(Tensor self, Tensor other) -> 张量 |
|
mm(Tensor self, Tensor mat2) -> 张量 |
|
穆尔。Scalar(Tensor self, Scalar other) -> 张量 |
|
穆尔。Tensor(Tensor self, Tensor other) -> Tensor |
|
native_batch_norm(张量输入、张量?权重、张量?偏置、张量running_mean、张量running_var、布尔训练、浮点动量、浮点 eps)->(张量、张量、张量) |
|
native_dropout(Tensor input, float p, bool? train) -> (Tensor, Tensor) |
|
native_group_norm(张量输入、张量权重、张量?偏置、SymInt N、SymInt C、SymInt HxW、int 组、浮点 eps)->(张量、张量、张量) |
|
native_group_norm_backward(张量grad_out,张量输入,张量均值,张量rstd,张量?权重,SymInt N,SymInt C,SymInt HxW,int 组,bool[3] output_mask) -> (张量,张量,张量) |
|
native_layer_norm(张量输入, SymInt[] normalized_shape, 张量权重, 张量? 偏差, 浮点 eps) -> (张量, 张量, 张量) |
|
native_layer_norm_backward(张量grad_out,张量输入,SymInt[] normalized_shape,张量均值,张量rstd,张量?权重,张量?偏差,bool[3] output_mask) -> (张量,张量,张量) |
|
ne.Scalar(Tensor self, Scalar other) -> 张量 |
|
ne.Tensor(Tensor self, Tensor other) -> Tensor |
|
neg(Tensor self) -> 张量 |
|
nonzero(Tensor self) -> 张量 |
|
permute(Tensor(a) self, int[] dims) -> 张量(a) |
|
战俘。Tensor_Scalar(Tensor self, Scalar exponent) -> 张量 |
|
战俘。Tensor_Tensor(Tensor self, Tensor exponent) -> Tensor |
|
reciprocal(Tensor self) -> 张量 |
|
reflection_pad2d(Tensor self, SymInt[4] padding) -> 张量 |
|
relu(Tensor self) -> Tensor |
|
剩余。Tensor(Tensor self, Tensor other) -> Tensor |
|
repeat(Tensor self, SymInt[] repeats) -> 张量 |
|
replication_pad2d(Tensor self, SymInt[4] padding) -> 张量 |
|
replication_pad3d(Tensor self, SymInt[6] padding) -> 张量 |
|
rsqrt(Tensor self) -> Tensor |
|
scalar_tensor(Scalar s, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> 张量 |
|
scatter_add(Tensor self, int dim, Tensor index, Tensor src) -> 张量 |
|
scatter_reduce.two(Tensor self, int dim, Tensor index, Tensor src, str reduce, *, bool include_self=True) -> 张量 |
|
select.int(Tensor(a) self, int dim, SymInt index) -> Tensor(a) |
|
sigmoid(Tensor self) -> 张量 |
|
sign(Tensor self) -> Tensor |
|
sin(Tensor self) -> 张量 |
|
sinh(Tensor self) -> Tensor |
|
片。Tensor(Tensor(a) self, int dim=0, SymInt? start=None, SymInt? end=None, SymInt step=1) -> 张量(a) |
|
slice_scatter(张量 self, 张量 src, int dim=0, SymInt? start=None, SymInt? end=None, SymInt step=1) -> 张量 |
|
sqrt(Tensor self) -> 张量 |
|
squeeze.dim(Tensor(a) self, int dim) -> 张量 (a) |
|
squeeze.dims(Tensor(a) self, int[] dim) -> 张量(a) |
|
子。Scalar(Tensor self, Scalar other, Scalar alpha=1) -> 张量 |
|
子。Tensor(Tensor self, Tensor other, *, 标量 alpha=1) -> 张量 |
|
sum.dim_IntList(Tensor self, int[1]? dim, bool keepdim=False, *, ScalarType? dtype=None) -> 张量 |
|
tanh(Tensor self) -> Tensor |
|
topk(张量 self, int k, int dim=-1, bool largest=True, bool sorted=True) -> (张量值, 张量索引) |
|
unsqueeze(张量(a) self, int dim) -> 张量(a) |
|
upsample_bilinear2d.vec(Tensor input, SymInt[]? output_size, bool align_corners, float[]? scale_factors) -> 张量 |
|
upsample_nearest2d.vec(Tensor input, SymInt[]? output_size, float[]? scale_factors) -> 张量 |
|
var.dim(Tensor self, int[1]? dim, bool unbiased=True, bool keepdim=False) -> 张量 |
|
view(Tensor(a) self, SymInt[] 大小) -> Tensor(a) |
|
where.self(Tensor condition, Tensor self, Tensor other) -> Tensor |
Prims IR¶
Prims IR 是一组基元运算符,可用于组合其他运算符。 Prims IR 是比 core aten IR 级别更低的 opset,它进一步将 ops 分解为 explicit 类型 Promotion and Broadcasting Ops: prims.convert_element_type 和 prims.broadcast_in_dim。 此 opset 旨在与编译器后端交互。
警告
此 opset 仍在积极开发中,未来将添加更多 ops。
算子 |
图式 |
---|---|
|
abs(Tensor self) -> 张量 |
|
acos(Tensor self) -> 张量 |
|
acosh(Tensor self) -> 张量 |
|
asin(Tensor self) -> 张量 |
|
asinh(Tensor self) -> Tensor |
|
atan(Tensor self) -> 张量 |
|
atanh(Tensor self) -> 张量 |
|
cos(Tensor self) -> 张量 |
|
cosh(Tensor self) -> 张量 |
|
bessel_i0(Tensor self) -> 张量 |
|
bessel_i0e(Tensor self) -> Tensor |
|
bessel_i1(Tensor self) -> 张量 |
|
bessel_i1e(Tensor self) -> 张量 |
|
bessel_j0(Tensor self) -> 张量 |
|
bessel_j1(Tensor self) -> 张量 |
|
bitwise_not(Tensor self) -> 张量 |
|
cbrt(Tensor self) -> 张量 |
|
ceil(Tensor self) -> 张量 |
|
conj_physical(Tensor self) -> 张量 |
|
digamma(Tensor self) -> 张量 |
|
erf(Tensor self) -> Tensor |
|
erf_inv(Tensor self) -> 张量 |
|
erfc(Tensor self) -> 张量 |
|
erfcx(Tensor self) -> Tensor |
|
exp(Tensor self) -> 张量 |
|
expm1(Tensor self) -> Tensor |
|
exp2(Tensor self) -> 张量 |
|
fill(Tensor self, Scalar value) -> 张量 |
|
floor(Tensor self) -> 张量 |
|
imag(Tensor self) -> 张量 |
|
isfinite(Tensor self) -> 张量 |
|
lgamma(Tensor self) -> 张量 |
|
log(Tensor self) -> Tensor |
|
log1p(Tensor self) -> Tensor |
|
log2(Tensor self) -> Tensor |
|
log10(Tensor self) -> Tensor |
|
ndtri(Tensor self) -> 张量 |
|
neg(Tensor self) -> 张量 |
|
real(Tensor self) -> 张量 |
|
reciprocal(Tensor self) -> 张量 |
|
round(Tensor self) -> 张量 |
|
sign(Tensor self) -> Tensor |
|
signbit(Tensor self) -> Tensor |
|
sin(Tensor self) -> 张量 |
|
sinh(Tensor self) -> Tensor |
|
spherical_bessel_j0(Tensor self) -> 张量 |
|
sqrt(Tensor self) -> 张量 |
|
tan(Tensor self) -> 张量 |
|
tanh(Tensor self) -> Tensor |
|
trunc(Tensor self) -> Tensor |
|
add(Tensor self, Tensor other) -> Tensor |
|
atan2(Tensor self, Tensor other) -> 张量 |
|
bitwise_and(Tensor self, Tensor other) -> 张量 |
|
bitwise_or(Tensor self, Tensor other) -> Tensor |
|
bitwise_xor(Tensor self, Tensor other) -> Tensor |
|
div(Tensor self, Tensor other) -> Tensor |
|
eq(Tensor self, Tensor other) -> Tensor |
|
fmax(Tensor self, Tensor other) -> Tensor |
|
fmin(Tensor self, Tensor other) -> 张量 |
|
fmod(Tensor self, Tensor other) -> 张量 |
|
gcd(Tensor self, Tensor other) -> Tensor |
|
ge(Tensor self, Tensor other) -> 张量 |
|
gt(Tensor self, Tensor other) -> 张量 |
|
hypot(Tensor self, Tensor other) -> 张量 |
|
igamma(Tensor self, Tensor other) -> 张量 |
|
igammac(Tensor self, Tensor other) -> 张量 |
|
le(Tensor self, Tensor other) -> 张量 |
|
lt(Tensor self, Tensor other) -> 张量 |
|
maximum(Tensor self, Tensor other) -> 张量 |
|
minimum(Tensor self, Tensor other) -> 张量 |
|
mul(Tensor self, Tensor other) -> 张量 |
|
ne(Tensor self, Tensor other) -> Tensor |
|
nextafter(Tensor self, Tensor other) -> 张量 |
|
pow(Tensor self, Tensor other) -> 张量 |
|
remainder(Tensor self, Tensor other) -> 张量 |
|
rsqrt(Tensor self) -> Tensor |
|
shift_left(Tensor self, Tensor other) -> 张量 |
|
shift_right_arithmetic(Tensor self, Tensor other) -> 张量 |
|
sub(Tensor self, Tensor other) -> Tensor |
|
zeta(Tensor self, Tensor other) -> 张量 |
|
as_strided(Tensor(a!) a, SymInt[] 大小, SymInt[] 步幅, SymInt storage_offset) -> Tensor(a!) |
|
broadcast_in_dim(Tensor(a) a, SymInt[] 形状, int[] broadcast_dimensions) -> Tensor(a) |
|
collapse_view(张量 (a) a, int start, int end) -> 张量 (a) |
|
conj(张量(a) a) -> 张量(a) |
|
slice(Tensor(a) a, SymInt[] start_indices, SymInt[] limit_indices, SymInt[]? strides=None) -> 张量(a) |
|
slice_in_dim(张量 (a) a, SymInt start_index, SymInt limit_index, int stride=1, int axis=0) -> 张量 (a) |
|
split_dim(张量 (a) a, int dim, SymInt outer_length) -> 张量 (a) |
|
squeeze(张量(a) a, int[] 维度) -> 张量(a) |
|
transpose(张量(a) a, int[] 排列) -> 张量(a) |
|
view_of(Tensor(a) a) -> 张量 |
|
as_strided_scatter(Tensor self, Tensor src, SymInt[] size, SymInt[] stride, SymInt storage_offset) -> 张量 |
|
cat(Tensor[] 张量, int dim) -> 张量 |
|
reshape(Tensor a, SymInt[] shape) -> 张量 |
|
rev(Tensor a, int[] dims) -> 张量 |
|
其中(Tensor pred, Tensor a, Tensor b) -> 张量 |
|
clone(Tensor self, *, MemoryFormat? memory_format=None) -> 张量 |
|
convert_element_type(Tensor a, ScalarType dtype) -> 张量 |
|
device_put(Tensor a, Device device) -> 张量 |
|
item(Tensor a) -> 标量 |
|
maximum_value(ScalarType dtype) -> 标量 |
|
minium_value(ScalarType dtype) -> 标量 |
|
copy_strided(Tensor a, SymInt[] stride) -> 张量 |
|
copy_to(张量 (a!) a, 张量 b) -> 张量 (a!) |
|
resize(Tensor(a!) a, SymInt[] 形状) -> Tensor(a!) |
|
amax(Tensor inp, int[]? dims, *, ScalarType? output_dtype=None) -> 张量 |
|
amin(Tensor inp, int[]? dims, *, ScalarType? output_dtype=None) -> 张量 |
|
prod(Tensor inp, int[]? dims, *, ScalarType? output_dtype=None) -> 张量 |
|
sum(Tensor inp, int[]? dims, *, ScalarType? output_dtype=None) -> 张量 |
|
var(Tensor inp, int[]? dims, *, int correction, ScalarType? output_dtype=None) -> 张量 |
|
empty_strided(SymInt[] 形状, SymInt[] 步幅, *, ScalarType dtype, 设备设备, bool requires_grad) -> 张量 |
|
scalar_tensor(Scalar s, *, ScalarType? dtype=None, Device? device=None) -> 张量 |
|
iota(SymInt length, *, SymInt start, SymInt step, ScalarType dtype, Device device, bool requires_grad) -> 张量 |
|
svd(张量 A, *, bool full_matrices) -> (张量 U, 张量 S, 张量 Vh) |
|
normal(SymInt[] 形状, *, 标量平均值, 标量标准, 标量类型 dtype, 设备设备, bool requires_grad) -> 张量 |
|
uniform(SymInt[] 形状, *, 标量低, 标量高, ScalarType dtype, 设备设备) -> 张量 |
|
fft_r2c(Tensor self, *, int[] dim, bool onesided) -> 张量 |
|
fft_c2c(Tensor self, *, int[] dim, bool forward) -> 张量 |
|
fft_c2r(Tensor self, *, int[] dim, SymInt last_dim_size) -> 张量 |