torch

若API未标明支持情况,则代表该API的支持情况待验证。

API名称

是否支持

限制与说明

torch.default_generator

     

torch.SymInt

是

  

torch.SymFloat

是

  

torch.SymBool

是

  

torch.Tag

是

  

torch.Tag.name

     

torch.is_tensor

是

  

torch.is_storage

是

  

torch.is_complex

是

  

torch.is_conj

     

torch.is_floating_point

是

  

torch.is_nonzero

是

  

torch.set_default_dtype

是

  

torch.get_default_dtype

是

  

torch.set_default_device

     

torch.set_default_tensor_type

是

  

torch.numel

是

  

torch.set_printoptions

是

  

torch.set_flush_denormal

是

  

torch.tensor

是

  

torch.sparse_coo_tensor

     

torch.sparse_csr_tensor

     

torch.sparse_csc_tensor

     

torch.sparse_bsr_tensor

     

torch.sparse_bsc_tensor

     

torch.asarray

是

  

torch.as_tensor

是

  

torch.as_strided

是

  

torch.from_numpy

是

  

torch.from_dlpack

     

torch.frombuffer

是

  

torch.zeros

是

支持fp16,fp32,int64, bool

torch.zeros_like

是

支持fp16,fp32,int64,bool

torch.ones

是

支持fp16,fp32,int64

torch.ones_like

是

支持fp16,fp32,int64

torch.arange

是

支持fp16,fp32,int64,bool

torch.range

是

支持fp16,fp32,int64,bool

torch.linspace

     

torch.logspace

     

torch.eye

是

支持fp16,fp32,int64,bool

torch.empty

是

  

torch.empty_like

是

支持fp16,fp32,int64,bool

torch.empty_strided

是

支持fp16,fp32,int64,bool

torch.full

是

支持fp16,fp32,int64,bool

torch.full_like

     

torch.quantize_per_tensor

     

torch.quantize_per_channel

     

torch.dequantize

     

torch.complex

     

torch.polar

     

torch.heaviside

     

torch.adjoint

     

torch.argwhere

是

支持fp16,fp32,int64,bool

torch.cat

是

支持fp16,fp32,int64,bool

torch.concat

是

支持fp16,fp32,int64,bool

torch.concatenate

是

支持fp16,fp32,int64,bool

torch.conj

是

支持fp16,fp32,int64,bool

torch.chunk

是

支持fp16,fp32,int64,bool

torch.dsplit

是

支持fp16,fp32,int64,bool

torch.column_stack

     

torch.dstack

是

支持fp16,fp32,int64,bool

torch.gather

是

支持fp16,fp32,int64,bool

torch.hsplit

是

支持fp16,fp32,int64,bool

torch.hstack

是

支持fp16,fp32,int64,bool

torch.index_add

是

支持fp16,fp32,int64,bool

torch.index_copy

是

支持fp16,fp32,int64,bool

torch.index_reduce

是

支持fp16,fp32,int64,bool

torch.index_select

     

torch.masked_select

是

支持fp16,fp32,int64,bool

torch.movedim

     

torch.moveaxis

是

  

torch.narrow

是

支持fp16,fp32,int64,bool

torch.narrow_copy

是

支持fp16,fp32,int64,bool

torch.nonzero

是

支持fp16,fp32,int64,bool

torch.permute

是

支持fp16,fp32,int64,bool

torch.reshape

     

torch.row_stack

是

支持fp16,fp32,int64,bool

torch.select

     

torch.scatter

是

支持fp16,fp32,int64,bool

torch.diagonal_scatter

是

支持fp16,fp32,int64,bool

torch.select_scatter

是

支持fp16,fp32,int64,bool

torch.slice_scatter

     

torch.scatter_add

     

torch.scatter_reduce

     

torch.split

是

支持fp16,fp32,int64,bool

torch.squeeze

是

支持fp16,fp32,int64

torch.stack

是

支持fp16,fp32,int64,bool

torch.swapaxes

     

torch.swapdims

     

torch.t

是

  

torch.take

是

支持fp16,fp32,int64,bool

torch.take_along_dim

是

支持fp16,fp32,int64,bool

torch.tensor_split

是

支持fp16,fp32,int64,bool

torch.tile

是

支持fp16,fp32,int64,bool

torch.transpose

是

支持fp16,fp32,int64,bool

torch.unbind

     

torch.unsqueeze

是

支持fp16,fp32,int64,bool

torch.vsplit

是

支持fp16,fp32,int64,bool

torch.vstack

是

支持fp16,fp32,int64,bool

torch.where

是

支持fp16,fp32,int64,bool;不支持8维shape

torch.Generator

是

  

torch.Generator.device

     

torch.Generator.get_state

是

  

torch.Generator.initial_seed

是

  

torch.Generator.manual_seed

是

  

torch.Generator.seed

是

  

torch.Generator.set_state

是

  

torch.seed

是

  

torch.manual_seed

是

  

torch.initial_seed

是

  

torch.get_rng_state

是

  

torch.set_rng_state

是

  

torch.bernoulli

是

支持fp16,fp32,int64,bool

torch.multinomial

是

支持fp16,fp32,int64,bool

torch.normal

是

支持fp16,fp32,int64,bool

torch.poisson

     

torch.rand

     

torch.rand_like

是

支持fp16,fp32,int64,bool

torch.randint

     

torch.randint_like

是

支持fp16,fp32,int64,bool

torch.randn

     

torch.randn_like

是

支持fp16,fp32,int64,bool

torch.randperm

是

支持fp16,fp32,int64,bool

torch.quasirandom.SobolEngine

     

torch.quasirandom.SobolEngine.draw

     

torch.quasirandom.SobolEngine.draw_base2

     

torch.quasirandom.SobolEngine.fast_forward

     

torch.quasirandom.SobolEngine.reset

     

torch.save

是

  

torch.load

是

  

torch.get_num_threads

是

  

torch.set_num_threads

是

  

torch.get_num_interop_threads

是

  

torch.set_num_interop_threads

是

  

torch.no_grad

是

  

torch.enable_grad

是

  

torch.set_grad_enabled

是

  

torch.is_grad_enabled

是

  

torch.inference_mode

是

  

torch.is_inference_mode_enabled

是

  

torch.abs

是

支持fp16,fp32,int64,bool

torch.absolute

是

支持fp16,fp32,int64,bool

torch.acos

是

支持fp16,fp32,int64,bool

torch.arccos

是

支持fp16,fp32,int64,bool

torch.acosh

是

支持fp16,fp32

torch.arccosh

是

支持fp16,fp32

torch.add

是

支持fp16,fp32,int64,bool

torch.addcdiv

是

支持fp16,fp32,int64,bool

在int64类型不支持三个tensor同时广播

torch.addcmul

是

支持fp16,fp32,fp64,int8,int32,int64,uint8,bool,bf16

在int8、uint8、int64、fp64类型不支持三个tensor同时广播

torch.angle

是

支持fp16,fp32,int64,bool

torch.asin

是

支持fp16,fp32,int64,bool

torch.arcsin

     

torch.asinh

是

支持fp16,fp32,int64,bool

torch.arcsinh

是

支持fp16,fp32,int64,bool

torch.atan

是

支持fp16,fp32,int64,bool

torch.arctan

是

支持fp16,fp32,int64,bool

torch.atanh

是

支持fp16,fp32,int64,bool

torch.arctanh

是

支持fp16,fp32,int64,bool

torch.atan2

     

torch.arctan2

是

支持fp16,fp32,int64,bool

torch.bitwise_not

是

支持fp16,fp32,int64,bool

torch.bitwise_and

是

支持fp16,fp32,int64,bool

torch.bitwise_or

是

支持fp16,fp32,int64,bool

torch.bitwise_xor

是

支持fp16,fp32,int64,bool

torch.bitwise_left_shift

     

torch.bitwise_right_shift

     

torch.ceil

是

支持fp16,fp32,int64,bool

torch.clamp

是

支持fp16,fp32,int64,bool

torch.clip

是

支持fp16,fp32,int64,bool

torch.conj_physical

     

torch.copysign

     

torch.cos

是

支持fp16,fp32,int64,bool

torch.cosh

是

支持fp16,fp32

torch.deg2rad

是

支持fp16,fp32,int64,bool

torch.div

是

支持fp16,fp32,int64,bool

torch.divide

是

支持fp16,fp32,int64,bool

torch.digamma

     

torch.erf

是

支持fp16,fp32,int64,bool

torch.erfc

是

支持fp16,fp32,int64,bool

torch.erfinv

是

支持fp16,fp32,int64,bool

torch.exp

是

支持fp16,fp32,int64,bool

torch.exp2

是

支持fp16,fp32,int64,bool

torch.expm1

是

支持fp16,fp32,int64,bool

torch.fake_quantize_per_channel_affine

     

torch.fake_quantize_per_tensor_affine

     

torch.fix

是

支持fp16,fp32,int64,bool

torch.float_power

是

支持fp16,fp32,int64,bool

torch.floor

是

支持fp16,fp32,int64,bool

torch.floor_divide

是

支持fp16,fp32,int64,bool

torch.fmod

是

支持fp16,fp32,int64,bool

torch.frac

     

torch.frexp

     

torch.gradient

     

torch.imag

     

torch.ldexp

是

支持fp16,fp32,int64,bool

torch.lerp

是

支持fp16,fp32,int64,bool

torch.lgamma

     

torch.log

是

支持fp16,fp32,int64,bool

torch.log10

     

torch.log1p

是

支持fp16,fp32,int64,bool

torch.log2

是

支持fp16,fp32,int64,bool

torch.logaddexp

是

支持fp16,fp32,int64,bool,不支持double数据类型。

torch.logaddexp2

是

支持fp16,fp32,int64,bool,不支持double数据类型。

torch.logical_and

是

支持fp16,fp32,int64,bool

torch.logical_not

是

支持fp16,fp32,int64,bool

torch.logical_or

是

支持fp16,fp32,int64,bool

torch.logical_xor

是

支持fp16,fp32,int64,bool

torch.logit

     

torch.hypot

     

torch.i0

     

torch.igamma

     

torch.igammac

     

torch.mul

是

支持fp16,fp32,int64,bool

torch.multiply

是

支持fp16,fp32,int64,bool

torch.mvlgamma

     

torch.nan_to_num

     

torch.neg

是

支持fp16,fp32,int64,bool

torch.negative

是

支持fp16,fp32,int64,bool

torch.nextafter

     

torch.polygamma

     

torch.positive

是

支持fp16,fp32,int64,bool

torch.pow(input, exponent, *, out=None) ->Tensor

是

不支持int64

Int类型使用的是浮点数方案,可能存在精度误差

torch.pow(self, exponent, *, out=None) ->Tensor

是

不支持int64

Int类型使用的是浮点数方案,可能存在精度误差

torch.quantized_batch_norm

     

torch.quantized_max_pool1d

     

torch.quantized_max_pool2d

     

torch.rad2deg

是

支持fp16,fp32,int64,bool

torch.real

是

支持fp16,fp32,int64,bool

torch.reciprocal

是

支持fp16,fp32,int64,bool

torch.remainder

是

支持fp16,fp32,int64,bool

torch.round

是

支持fp16,fp32,int64,bool

torch.rsqrt

是

支持fp16,fp32,int64,bool

torch.sigmoid

是

支持fp16,fp32,int64,bool

torch.sign

是

支持fp16,fp32,int64,bool

torch.sgn

是

支持fp16,fp32,int64,bool

torch.signbit

     

torch.sin

是

支持fp16,fp32,int64,bool

torch.sinc

     

torch.sinh

是

支持fp16,fp32

torch.softmax

是

支持fp16,fp32,int64,bool

torch.sqrt

是

支持fp16,fp32

torch.square

是

支持fp16,fp32,int64

torch.sub

是

支持fp16,fp32,int64

torch.subtract

     

torch.tan

是

支持fp16,fp32,int64

torch.tanh

是

支持fp16,fp32,int64

torch.true_divide

是

支持fp16,fp32,int64,bool

torch.trunc

是

支持fp16,fp32,int64,bool

torch.xlogy

是

支持fp16,fp32

torch.argmax

是

支持fp16,fp32,int64

torch.argmin

是

支持fp16,fp32,int64,bool

torch.amax

是

支持fp16,fp32,int64,bool

torch.amin

是

支持fp16,fp32,int64,bool

torch.aminmax

是

支持fp16,fp32,int64,bool

torch.all

是

支持fp16,fp32,int64,bool

torch.any

是

支持fp16,fp32,int64,bool

torch.max

是

支持fp16,fp32,int64,bool

torch.min

是

支持fp16,fp32,int64,bool

torch.dist

     

torch.logsumexp

是

支持fp16,fp32,int64,bool

torch.mean

是

支持fp16,fp32,int64,bool

torch.nanmean

     

torch.median

是

支持fp16,fp32,int64

torch.nanmedian

     

torch.mode

     

torch.norm

     

torch.nansum

     

torch.prod

是

支持fp16,fp32,int64,bool

torch.quantile

     

torch.nanquantile

     

torch.std

是

支持fp16,fp32

torch.std_mean

     

torch.sum

是

支持fp16,fp32,int64,bool;不支持dtype参数

torch.unique

是

支持fp16,fp32,int64,bool

torch.unique_consecutive

     

torch.var

是

支持fp16,fp32

torch.var_mean

     

torch.count_nonzero

是

支持fp16,fp32,int64,bool

torch.allclose

是

支持fp16,fp32,int64,bool

torch.argsort

是

支持fp16,fp32,int64,bool

torch.eq

是

支持fp16,fp32,int64,bool

torch.equal

是

支持fp16,fp32,int64,bool

torch.ge

是

支持fp16,fp32,int64,bool

torch.greater_equal

是

支持fp16,fp32,int64,bool

torch.gt

是

支持fp16,fp32,int64,bool

torch.greater

是

支持fp16,fp32,int64,bool

torch.isclose

是

支持fp16,fp32,int64,bool

torch.isfinite

是

支持fp16,fp32,int64,bool

torch.isin

     

torch.isinf

是

支持fp16,fp32,int64,bool

torch.isposinf

是

支持fp16,fp32,int64,bool

torch.isneginf

是

支持fp16,fp32,int64,bool

torch.isnan

是

支持fp16,fp32,int64,bool

torch.isreal

     

torch.kthvalue

是

支持fp16,fp32

torch.le

是

支持fp16,fp32,int64,bool

torch.less_equal

是

支持fp16,fp32,int64,bool

torch.lt

是

支持fp16,fp32,int64,bool

torch.less

是

支持fp16,fp32,int64,bool

torch.maximum

是

支持fp16,fp32,int64,bool

torch.minimum

是

支持fp16,fp32,int64,bool

torch.fmax

     

torch.fmin

     

torch.ne

是

支持fp16,fp32,int64,bool

torch.not_equal

是

支持fp16,fp32,int64,bool

torch.sort

是

支持fp16,fp32,int64,bool

torch.topk

是

支持fp16,fp32,int64,bool;不支持sorted=False场景

torch.msort

是

支持fp16,fp32,int64,bool

torch.stft

     

torch.istft

     

torch.bartlett_window

     

torch.blackman_window

     

torch.hamming_window

     

torch.hann_window

     

torch.kaiser_window

     

torch.atleast_1d

     

torch.atleast_2d

     

torch.atleast_3d

     

torch.bincount

是

支持fp16,fp32,int64,bool

torch.block_diag

是

支持fp16,fp32,int64,bool

torch.broadcast_tensors

是

支持fp16,fp32,int64,bool

torch.broadcast_to

     

torch.broadcast_shapes

是

支持fp16,fp32,int64,bool

torch.bucketize

     

torch.cartesian_prod

     

torch.cdist

     

torch.clone

是

支持fp16,fp32,int64,bool

torch.combinations

是

支持fp16,fp32,int64,bool

torch.corrcoef

     

torch.cov

是

支持fp16,fp32,int64,bool

torch.cross

  

两个输入的shape要保持一致

torch.cummax

是

支持fp16,fp32,int64,bool

torch.cummin

     

torch.cumprod

     

torch.cumsum

是

支持fp16,fp32,int64,bool

torch.diag

是

支持fp16,fp32,int64,bool

torch.diag_embed

     

torch.diagflat

     

torch.diagonal

是

支持fp16,fp32,int64,bool

torch.diff

是

支持fp16,fp32,int64,bool

torch.einsum

是

支持fp16,fp32,int64,bool

torch.flatten

是

支持fp16,fp32,int64,bool

torch.flip

是

支持fp16,fp32,int64,bool

torch.fliplr

是

支持fp16,fp32,int64,bool

torch.flipud

是

支持fp16,fp32,int64,bool

torch.kron

     

torch.rot90

     

torch.gcd

     

torch.histc

是

支持fp16,fp32,int64,bool

torch.histogram

     

torch.histogramdd

     

torch.meshgrid

是

支持fp16,fp32,int64,bool

torch.lcm

     

torch.logcumsumexp

     

torch.ravel

是

支持fp16,fp32,int64,bool

torch.renorm

  

支持fp16,fp32

属性max_norm仅支持非负值

torch.repeat_interleave

是

支持fp16,fp32,int64,bool

torch.roll

是

支持fp16,fp32,int64,bool

torch.searchsorted

是

支持fp16,fp32,int64

torch.tensordot

     

torch.trace

是

支持fp16,fp32,fp64,int8,int16,int32,int64,uint8,complex64,complex128

torch.tril

是

支持fp16,fp32,int64,bool

torch.tril_indices

是

支持fp16,fp32,int64,bool

torch.triu

是

支持fp16,fp32,int64,bool

torch.triu_indices

是

支持fp16,fp32,int64,bool

torch.unflatten

是

  

torch.vander

     

torch.view_as_real

是

支持fp16,fp32,int64,bool

torch.view_as_complex

     

torch.resolve_conj

是

支持fp16,fp32,int64,bool

torch.resolve_neg

是

支持fp16,fp32,int64,bool

torch.addbmm

是

支持fp16,fp32,int64,bool

torch.addmm

是

支持fp16,fp32,int64,bool

torch.addmv

是

支持fp16,fp32,int64,bool

torch.addr

是

支持fp16,fp32,int64,bool

torch.baddbmm

是

支持fp16,fp32,int64,bool

torch.bmm

是

支持fp16,fp32,int64,bool

torch.chain_matmul

     

torch.cholesky

     

torch.cholesky_inverse

     

torch.cholesky_solve

     

torch.dot

是

支持fp16,fp32,int64,bool

torch.geqrf

     

torch.ger

     

torch.inner

     

torch.inverse

     

torch.det

     

torch.logdet

     

torch.slogdet

是

支持fp16,fp32,int64,bool

torch.lu

     

torch.lu_solve

     

torch.lu_unpack

     

torch.matmul

是

支持fp16,fp32,int64,bool

torch.matrix_power

     

torch.matrix_exp

     

torch.mm

是

支持fp16,fp32,int64,bool

torch.mv

     

torch.orgqr

     

torch.ormqr

     

torch.outer

     

torch.pinverse

     

torch.qr

是

支持fp16,fp32,int64,bool

torch.svd

     

torch.svd_lowrank

     

torch.pca_lowrank

     

torch.lobpcg

     

torch.trapz

     

torch.trapezoid

是

支持fp16,fp32,int64,bool

torch.cumulative_trapezoid

是

支持fp16,fp32,int64,bool

torch.triangular_solve

     

torch.vdot

     

torch._foreach_abs

     

torch._foreach_abs_

     

torch._foreach_acos

     

torch._foreach_acos_

     

torch._foreach_asin

     

torch._foreach_asin_

     

torch._foreach_atan

     

torch._foreach_atan_

     

torch._foreach_ceil

     

torch._foreach_ceil_

     

torch._foreach_cos

     

torch._foreach_cos_

     

torch._foreach_cosh

     

torch._foreach_cosh_

     

torch._foreach_erf

     

torch._foreach_erf_

     

torch._foreach_erfc

     

torch._foreach_erfc_

     

torch._foreach_exp

     

torch._foreach_exp_

     

torch._foreach_expm1

     

torch._foreach_expm1_

     

torch._foreach_floor

     

torch._foreach_floor_

     

torch._foreach_log

     

torch._foreach_log_

     

torch._foreach_log10

     

torch._foreach_log10_

     

torch._foreach_log1p

     

torch._foreach_log1p_

     

torch._foreach_log2

     

torch._foreach_log2_

     

torch._foreach_neg

     

torch._foreach_neg_

     

torch._foreach_tan

     

torch._foreach_tan_

     

torch._foreach_sin

     

torch._foreach_sin_

     

torch._foreach_sinh

     

torch._foreach_sinh_

     

torch._foreach_round

     

torch._foreach_round_

     

torch._foreach_sqrt

     

torch._foreach_sqrt_

     

torch._foreach_lgamma

     

torch._foreach_lgamma_

     

torch._foreach_frac

     

torch._foreach_frac_

     

torch._foreach_reciprocal

     

torch._foreach_reciprocal_

     

torch._foreach_sigmoid

     

torch._foreach_sigmoid_

     

torch._foreach_trunc

     

torch._foreach_trunc_

     

torch._foreach_zero_

     

torch.compiled_with_cxx11_abi

是

  

torch.result_type

是

  

torch.can_cast

是

  

torch.promote_types

是

  

torch.use_deterministic_algorithms

是

  

torch.are_deterministic_algorithms_enabled

是

  

torch.is_deterministic_algorithms_warn_only_enabled

     

torch.set_deterministic_debug_mode

是

  

torch.get_deterministic_debug_mode

是

  

torch.set_float32_matmul_precision

     

torch.get_float32_matmul_precision

     

torch.set_warn_always

是

  

torch.is_warn_always_enabled

是

  

torch.vmap

是

  

torch._assert

是

  

torch.sym_float

是

  

torch.sym_int

是

  

torch.sym_max

是

  

torch.sym_min

是

  

torch.sym_not

是

  

torch.compile

是