PyTorch与MindSpore API映射表

查看源文件

由社区提供的PyTorch APIs和MindSpore APIs之间的映射,可能在参数、输入、输出、逻辑功能和特定场景等方面存在差异,可详见各API描述或已提供的差异对比。

也欢迎更多的MindSpore开发者参与完善映射内容。

通用差异参数表

因为框架机制原因,MindSpore不提供PyTorch的以下参数:

参数名

功能

out

表示输出的Tensor

layout

表示内存分布策略

device

表示Tensor存放位置

requires_grad

表示是否更新梯度

generator

表示伪随机数生成器

pin_memory

表示是否使用锁页内存

memory_format

表示Tensor的内存格式

stable

表示是否稳定排序

inplace

表示在不更改变量内存地址的情况下,直接修改变量的值

sparse_grad

表示是否对梯度稀疏化

size_average

PyTorch废弃参数

reduce

PyTorch废弃参数

PyTorch 1.8.1

torch

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.abs

mindspore.ops.abs

一致

torch.absolute

mindspore.ops.absolute

一致

torch.acos

mindspore.ops.acos

一致

torch.acosh

mindspore.ops.acosh

一致

torch.add

mindspore.ops.add

一致

torch.addbmm

mindspore.ops.addbmm

一致

torch.addcdiv

mindspore.ops.addcdiv

一致

torch.addcmul

mindspore.ops.addcmul

一致

torch.addmm

mindspore.ops.addmm

一致

torch.addmv

mindspore.ops.addmv

功能一致,参数名不同

torch.addr

mindspore.ops.addr

功能一致,参数名不同

torch.all

mindspore.ops.all

差异对比

torch.amax

mindspore.ops.amax

差异对比

torch.amin

mindspore.ops.amin

差异对比

torch.angle

mindspore.ops.angle

一致

torch.any

mindspore.ops.any

差异对比

torch.arange

mindspore.ops.arange

一致

torch.arccos

mindspore.ops.arccos

一致

torch.arccosh

mindspore.ops.arccosh

一致

torch.arcsin

mindspore.ops.arcsin

功能一致,参数名不同

torch.arcsinh

mindspore.ops.arcsinh

功能一致,参数名不同

torch.arctan

mindspore.ops.arctan

一致

torch.arctanh

mindspore.ops.arctanh

功能一致,参数名不同

torch.argmax

mindspore.ops.argmax

一致

torch.argmin

mindspore.ops.argmin

差异对比

torch.argsort

mindspore.ops.argsort

一致

torch.asin

mindspore.ops.asin

一致

torch.asinh

mindspore.ops.asinh

一致

torch.atan

mindspore.ops.atan

一致

torch.atan2

mindspore.ops.atan2

一致

torch.atanh

mindspore.ops.atanh

一致

torch.atleast_1d

mindspore.ops.atleast_1d

功能一致,参数名不同

torch.atleast_2d

mindspore.ops.atleast_2d

功能一致,参数名不同

torch.atleast_3d

mindspore.ops.atleast_3d

功能一致,参数名不同

torch.baddbmm

mindspore.ops.baddbmm

一致

torch.bartlett_window

mindspore.ops.bartlett_window

差异对比

torch.bernoulli

mindspore.ops.bernoulli

功能一致,参数个数或顺序不一致

torch.bincount

mindspore.ops.bincount

一致

torch.bitwise_and

mindspore.ops.bitwise_and

一致

torch.bitwise_or

mindspore.ops.bitwise_or

一致

torch.bitwise_xor

mindspore.ops.bitwise_xor

一致

torch.blackman_window

mindspore.ops.blackman_window

差异对比

torch.block_diag

mindspore.ops.block_diag

功能一致,参数名不同

torch.bmm

mindspore.ops.bmm

功能一致,参数名不同

torch.broadcast_to

mindspore.ops.broadcast_to

差异对比

torch.cat

mindspore.ops.cat

差异对比

torch.cdist

mindspore.ops.cdist

差异对比

torch.ceil

mindspore.ops.ceil

一致

torch.cholesky

mindspore.ops.cholesky

功能一致,参数名不同

torch.cholesky_solve

mindspore.ops.cholesky_solve

一致

torch.chunk

mindspore.ops.chunk

一致

torch.clamp

mindspore.ops.clamp

一致

torch.clip

mindspore.ops.clip

一致

torch.column_stack

mindspore.ops.column_stack

一致

torch.combinations

mindspore.ops.combinations

功能一致,参数名不同

torch.conj

mindspore.ops.conj

一致

torch.copysign

mindspore.ops.copysign

功能一致,参数名不同

torch.cos

mindspore.ops.cos

一致

torch.cosh

mindspore.ops.cosh

一致

torch.count_nonzero

mindspore.ops.count_nonzero

一致

torch.cross

mindspore.ops.cross

一致

torch.cummax

mindspore.ops.cummax

一致

torch.cummin

mindspore.ops.cummin

一致

torch.cumprod

mindspore.ops.cumprod

一致

torch.cumsum

mindspore.ops.cumsum

差异对比

torch.deg2rad

mindspore.ops.deg2rad

功能一致,参数名不同

torch.diag

mindspore.ops.diag

差异对比

torch.diag_embed

mindspore.ops.diag_embed

一致

torch.diagflat

mindspore.ops.diagflat

一致

torch.diagonal

mindspore.ops.diagonal

一致

torch.diff

mindspore.ops.diff

功能一致,参数名不同

torch.digamma

mindspore.ops.digamma

一致

torch.dist

mindspore.ops.dist

一致

torch.div

mindspore.ops.div

一致

torch.divide

mindspore.ops.divide

一致

torch.dot

mindspore.ops.tensor_dot

差异对比

torch.dstack

mindspore.ops.dstack

功能一致,参数名不同

torch.empty

mindspore.numpy.empty

差异对比

torch.empty_like

mindspore.numpy.empty_like

差异对比

torch.einsum

mindspore.ops.einsum

一致

torch.eq

mindspore.ops.equal

一致

torch.erf

mindspore.ops.erf

一致

torch.erfc

mindspore.ops.erfc

一致

torch.erfinv

mindspore.ops.erfinv

一致

torch.exp

mindspore.ops.exp

一致

torch.exp2

mindspore.ops.exp2

一致

torch.expm1

mindspore.ops.expm1

一致

torch.eye

mindspore.ops.eye

一致

torch.flatten

mindspore.ops.flatten

差异对比

torch.float_power

mindspore.ops.float_power

差异对比

torch.flip

mindspore.ops.flip

一致

torch.fliplr

mindspore.ops.fliplr

一致

torch.flipud

mindspore.ops.flipud

一致

torch.floor

mindspore.ops.floor

一致

torch.fmax

mindspore.ops.fmax

一致

torch.fmod

mindspore.ops.fmod

一致

torch.frac

mindspore.ops.frac

功能一致,参数名不同

torch.full

mindspore.ops.full

差异对比

torch.full_like

mindspore.ops.full_like

一致

torch.gather

mindspore.ops.gather_elements

一致

torch.gcd

mindspore.ops.gcd

一致

torch.ge

mindspore.ops.ge

功能一致,参数名不同

torch.geqrf

mindspore.ops.geqrf

一致

torch.ger

mindspore.ops.ger

差异对比

torch.greater

mindspore.ops.greater

一致

torch.greater_equal

mindspore.ops.greater_equal

一致

torch.gt

mindspore.ops.gt

功能一致,参数名不同

torch.hann_window

mindspore.numpy.hanning

差异对比

torch.hann_window

mindspore.ops.hann_window

一致

torch.heaviside

mindspore.ops.heaviside

一致

torch.hstack

mindspore.ops.hstack

一致

torch.histc

mindspore.ops.histc

一致

torch.hypot

mindspore.ops.hypot

一致

torch.hamming_window

mindspore.ops.hamming_window

一致

torch.i0

mindspore.ops.i0

一致

torch.igamma

mindspore.ops.igamma

一致

torch.igammac

mindspore.ops.igammac

一致

torch.imag

mindspore.ops.imag

一致

torch.index_select

mindspore.ops.index_select

功能一致,参数名不同

torch.inner

mindspore.ops.inner

一致

torch.inverse

mindspore.ops.inverse

一致

torch.isclose

mindspore.ops.isclose

功能一致,参数名不同

torch.isfinite

mindspore.ops.isfinite

一致

torch.isinf

mindspore.ops.isinf

一致

torch.isnan

mindspore.ops.isnan

一致

torch.isneginf

mindspore.ops.isneginf

一致

torch.isposinf

mindspore.ops.isposinf

一致

torch.isreal

mindspore.ops.isreal

一致

torch.is_complex

mindspore.ops.is_complex

功能一致,参数名不同

torch.is_floating_point

mindspore.ops.is_floating_point

功能一致,参数名不同

torch.is_tensor

mindspore.ops.is_tensor

一致

torch.kaiser_window

mindspore.ops.kaiser_window

一致

torch.kron

mindspore.ops.kron

功能一致,参数名不同

torch.lcm

mindspore.ops.lcm

一致

torch.ldexp

mindspore.ops.ldexp

功能一致,参数名不同

torch.le

mindspore.ops.le

功能一致,参数名不同

torch.lerp

mindspore.ops.lerp

功能一致,参数名不同

torch.less

mindspore.ops.less

功能一致,参数名不同

torch.less_equal

mindspore.ops.less_equal

功能一致,参数名不同

torch.linalg.norm

mindspore.ops.norm

一致

torch.linspace

mindspore.ops.linspace

一致

torch.log

mindspore.ops.log

一致

torch.log2

mindspore.ops.log2

一致

torch.log10

mindspore.ops.log10

一致

torch.logaddexp

mindspore.ops.logaddexp

一致

torch.logaddexp2

mindspore.ops.logaddexp2

一致

torch.log1p

mindspore.ops.log1p

功能一致,参数名不同

torch.logdet

mindspore.ops.logdet

一致

torch.logical_and

mindspore.ops.logical_and

一致

torch.logical_not

mindspore.ops.logical_not

一致

torch.logical_or

mindspore.ops.logical_or

一致

torch.logical_xor

mindspore.ops.logical_xor

一致

torch.logit

mindspore.ops.logit

一致

torch.logspace

mindspore.ops.logspace

一致

torch.logsumexp

mindspore.ops.logsumexp

一致

torch.lt

mindspore.ops.lt

一致

torch.masked_select

mindspore.ops.masked_select

一致

torch.matmul

mindspore.ops.matmul

一致

torch.max

mindspore.ops.max

差异对比

torch.maximum

mindspore.ops.maximum

功能一致,参数名不同

torch.mean

mindspore.ops.mean

功能一致,参数名不同

torch.median

mindspore.ops.median

差异对比

torch.meshgrid

mindspore.ops.meshgrid

差异对比

torch.mm

mindspore.ops.mm

一致

torch.mul

mindspore.ops.mul

功能一致,参数名不同

torch.min

mindspore.ops.min

差异对比

torch.minimum

mindspore.ops.minimum

功能一致,参数名不同

torch.msort

mindspore.ops.msort

一致

torch.moveaxis

mindspore.ops.moveaxis

一致

torch.movedim

mindspore.ops.movedim

一致

torch.multinomial

mindspore.ops.multinomial

功能一致,参数默认值不一致

torch.multiply

mindspore.ops.multiply

一致

torch.mv

mindspore.ops.mv

功能一致,参数名不同

torch.mvlgamma

mindspore.ops.mvlgamma

一致

torch.nan_to_num

mindspore.ops.nan_to_num

一致

torch.nansum

mindspore.ops.nansum

一致

torch.narrow

mindspore.ops.narrow

功能一致

torch.ne

mindspore.ops.ne

功能一致,参数名不同

torch.neg

mindspore.ops.neg

一致

torch.negative

mindspore.ops.negative

一致

torch.nextafter

mindspore.ops.nextafter

一致

torch.nonzero

mindspore.ops.nonzero

功能一致,参数名不同

torch.normal

mindspore.ops.normal

功能一致,参数个数或顺序不一致

torch.not_equal

mindspore.ops.not_equal

一致

torch.numel

mindspore.ops.numel

一致

torch.ones

mindspore.ops.ones

差异对比

torch.ones_like

mindspore.ops.ones_like

一致

torch.orgqr

mindspore.ops.orgqr

一致

torch.ormqr

mindspore.ops.ormqr

一致

torch.outer

mindspore.ops.outer

功能一致,参数名不同

torch.poisson

mindspore.ops.random_poisson

差异对比

torch.polar

mindspore.ops.polar

一致

torch.polygamma

mindspore.ops.polygamma

一致

torch.pow

mindspore.ops.pow

功能一致,参数名不同

torch.prod

mindspore.ops.prod

差异对比

torch.rad2deg

mindspore.ops.rad2deg

功能一致,参数名不同

torch.rand

mindspore.ops.rand

一致

torch.rand_like

mindspore.ops.rand_like

一致

torch.randn

mindspore.ops.randn

一致

torch.randn_like

mindspore.ops.randn_like

一致

torch.randint

mindspore.ops.randint

差异对比

torch.randint_like

mindspore.ops.randint_like

差异对比

torch.randperm

mindspore.ops.randperm

功能一致,参数名不同

torch.range

mindspore.ops.range

差异对比

torch.ravel

mindspore.ops.ravel

一致

torch.real

mindspore.ops.real

一致

torch.reciprocal

mindspore.ops.reciprocal

一致

torch.remainder

mindspore.ops.remainder

一致

torch.renorm

mindspore.ops.renorm

差异对比

torch.repeat_interleave

mindspore.ops.repeat_interleave

功能一致,参数名不同

torch.reshape

mindspore.ops.reshape

一致

torch.rot90

mindspore.ops.rot90

一致

torch.round

mindspore.ops.round

一致

torch.rsqrt

mindspore.ops.rsqrt

一致

torch.searchsorted

mindspore.ops.searchsorted

一致

torch.scatter

mindspore.ops.scatter

差异对比

torch.scatter_add

mindspore.ops.tensor_scatter_elements

差异对比

torch.sgn

mindspore.ops.sgn

一致

torch.sigmoid

mindspore.ops.sigmoid

一致

torch.sign

mindspore.ops.sign

一致

torch.signbit

mindspore.ops.signbit

一致

torch.sin

mindspore.ops.sin

一致

torch.sinc

mindspore.ops.sinc

一致

torch.sinh

mindspore.ops.sinh

一致

torch.slogdet

mindspore.ops.slogdet

一致

torch.sort

mindspore.ops.sort

功能一致,参数名不同

torch.split

mindspore.ops.split

功能一致,参数名不同

torch.stack

mindspore.ops.stack

一致

torch.squeeze

mindspore.ops.squeeze

功能一致,参数名不一致

torch.std

mindspore.ops.std

差异对比

torch.std_mean

mindspore.ops.std_mean

差异对比

torch.sqrt

mindspore.ops.sqrt

功能一致,参数名不同

torch.square

mindspore.ops.square

一致

torch.sub

mindspore.ops.subtract

功能一致,参数名不同

torch.subtract

mindspore.ops.subtract

一致

torch.sum

mindspore.ops.sum

功能一致,参数名不同

torch.svd

mindspore.ops.svd

差异对比

torch.swapaxes

mindspore.ops.swapaxes

一致

torch.swapdims

mindspore.ops.swapdims

一致

torch.t

mindspore.ops.t

一致

torch.tan

mindspore.ops.tan

一致

torch.tanh

mindspore.ops.tanh

一致

torch.tensor_split

mindspore.ops.tensor_split

一致

torch.tile

mindspore.ops.tile

功能一致,参数名不同

torch.topk

mindspore.ops.topk

一致

torch.trace

mindspore.ops.trace

一致

torch.transpose

mindspore.ops.swapaxes

一致

torch.trapz

mindspore.ops.trapz

一致

torch.tril

mindspore.ops.tril

一致

torch.tril_indices

mindspore.ops.tril_indices

一致

torch.triu_indices

mindspore.ops.triu_indices

一致

torch.true_divide

mindspore.ops.true_divide

一致

torch.trunc

mindspore.ops.trunc

一致

torch.unbind

mindspore.ops.unbind

一致

torch.unique

mindspore.ops.unique

差异对比

torch.unique_consecutive

mindspore.ops.unique_consecutive

一致

torch.unsqueeze

mindspore.ops.unsqueeze

一致

torch.var

mindspore.ops.var

差异对比

torch.var_mean

mindspore.ops.var_mean

差异对比

torch.view_as_real

mindspore.ops.view_as_real

一致

torch.vstack

mindspore.ops.vstack

功能一致,参数名不同

torch.where

mindspore.ops.where

一致

torch.xlogy

mindspore.ops.xlogy

一致

torch.zeros

mindspore.ops.zeros

差异对比

torch.zeros_like

mindspore.ops.zeros_like

一致

torch.distributions

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.distributions.laplace.Laplace

mindspore.ops.standard_laplace

差异对比

torch.distributed

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.distributed.all_gather

mindspore.ops.AllGather

差异对比

torch.distributed.all_reduce

mindspore.ops.AllReduce

差异对比

torch.distributed.get_rank

mindspore.communication.get_rank

差异对比

torch.distributed.init_process_group

mindspore.communication.init

差异对比

torch.distributed.new_group

mindspore.communication.create_group

差异对比

torch.nn

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.nn.AdaptiveAvgPool1d

mindspore.nn.AdaptiveAvgPool1d

差异对比

torch.nn.AdaptiveAvgPool2d

mindspore.nn.AdaptiveAvgPool2d

一致

torch.nn.AdaptiveAvgPool3d

mindspore.nn.AdaptiveAvgPool3d

一致

torch.nn.AdaptiveMaxPool1d

mindspore.nn.AdaptiveMaxPool1d

差异对比

torch.nn.AdaptiveMaxPool2d

mindspore.nn.AdaptiveMaxPool2d

一致

torch.nn.AdaptiveMaxPool3d

mindspore.nn.AdaptiveMaxPool3d

一致

torch.nn.AvgPool1d

mindspore.nn.AvgPool1d

差异对比

torch.nn.AvgPool2d

mindspore.nn.AvgPool2d

差异对比

torch.nn.AvgPool3d

mindspore.nn.AvgPool3d

差异对比

torch.nn.BCEWithLogitsLoss

mindspore.nn.BCEWithLogitsLoss

差异对比

torch.nn.BatchNorm1d

mindspore.nn.BatchNorm1d

差异对比

torch.nn.BatchNorm2d

mindspore.nn.BatchNorm2d

差异对比

torch.nn.BatchNorm3d

mindspore.nn.BatchNorm3d

差异对比

torch.nn.Bilinear

mindspore.nn.BiDense

差异对比

torch.nn.CeLU

mindspore.nn.CELU

一致

torch.nn.ChannelShuffle

mindspore.nn.ChannelShuffle

一致

torch.nn.CTCLoss

mindspore.nn.CTCLoss

一致

torch.nn.ConstantPad1d

mindspore.nn.ConstantPad1d

一致

torch.nn.ConstantPad2d

mindspore.nn.ConstantPad2d

一致

torch.nn.ConstantPad3d

mindspore.nn.ConstantPad3d

一致

torch.nn.Conv1d

mindspore.nn.Conv1d

差异对比

torch.nn.Conv2d

mindspore.nn.Conv2d

差异对比

torch.nn.Conv3d

mindspore.nn.Conv3d

差异对比

torch.nn.ConvTranspose1d

mindspore.nn.Conv1dTranspose

差异对比

torch.nn.ConvTranspose2d

mindspore.nn.Conv2dTranspose

差异对比

torch.nn.ConvTranspose3d

mindspore.nn.Conv3dTranspose

差异对比

torch.nn.CosineEmbeddingLoss

mindspore.nn.CosineEmbeddingLoss

差异对比

torch.nn.CrossEntropyLoss

mindspore.nn.CrossEntropyLoss

差异对比

torch.nn.Dropout

mindspore.nn.Dropout

差异对比

torch.nn.Dropout2d

mindspore.nn.Dropout2d

一致

torch.nn.Dropout3d

mindspore.nn.Dropout3d

一致

torch.nn.ELU

mindspore.nn.ELU

一致

torch.nn.GaussianNLLLoss

mindspore.nn.GaussianNLLLoss

差异对比

torch.nn.GELU

mindspore.nn.GELU

差异对比

torch.nn.GRU

mindspore.nn.GRU

差异对比

torch.nn.GRUCell

mindspore.nn.GRUCell

差异对比

torch.nn.GroupNorm

mindspore.nn.GroupNorm

差异对比

torch.nn.Hardshrink

mindspore.nn.HShrink

差异对比

torch.nn.Hardsigmoid

mindspore.nn.Hsigmoid

一致

torch.nn.Hardswish

mindspore.nn.Hswish

一致

torch.nn.Hardtanh

mindspore.nn.Hardtanh

一致

torch.nn.HingeEmbeddingLoss

mindspore.nn.HingeEmbeddingLoss

一致

torch.nn.Identity

mindspore.nn.Identity

功能一致,参数名不同

torch.nn.init.uniform_

mindspore.ops.uniform

差异对比

torch.nn.InstanceNorm1d

mindspore.nn.InstanceNorm1d

差异对比

torch.nn.InstanceNorm2d

mindspore.nn.InstanceNorm2d

差异对比

torch.nn.InstanceNorm3d

mindspore.nn.InstanceNorm3d

差异对比

torch.nn.KLDivLoss

mindspore.nn.KLDivLoss

一致

torch.nn.L1Loss

mindspore.nn.L1Loss

差异对比

torch.nn.LayerNorm

mindspore.nn.LayerNorm

差异对比

torch.nn.LeakyReLU

mindspore.nn.LeakyReLU

差异对比

torch.nn.LPPool1d

mindspore.nn.LPPool1d

一致

torch.nn.LPPool2d

mindspore.nn.LPPool2d

一致

torch.nn.LSTM

mindspore.nn.LSTM

差异对比

torch.nn.LSTMCell

mindspore.nn.LSTMCell

差异对比

torch.nn.Linear

mindspore.nn.Dense

差异对比

torch.nn.LocalResponseNorm

mindspore.ops.LRN

差异对比

torch.nn.LogSigmoid

mindspore.nn.LogSigmoid

一致

torch.nn.MSELoss

mindspore.nn.MSELoss

差异对比

torch.nn.MarginRankingLoss

mindspore.nn.MarginRankingLoss

一致

torch.nn.MaxPool1d

mindspore.nn.MaxPool1d

差异对比

torch.nn.MaxPool2d

mindspore.nn.MaxPool2d

差异对比

torch.nn.MaxPool3d

mindspore.nn.MaxPool3d

差异对比

torch.nn.MaxUnpool1d

mindspore.nn.MaxUnpool1d

一致

torch.nn.MaxUnpool2d

mindspore.nn.MaxUnpool2d

一致

torch.nn.MaxUnpool3d

mindspore.nn.MaxUnpool3d

一致

torch.nn.MultiheadAttention

mindspore.nn.MultiheadAttention

一致

torch.nn.MultiLabelSoftMarginLoss

mindspore.nn.MultiLabelSoftMarginLoss

一致

torch.nn.MultiMarginLoss

mindspore.nn.MultiMarginLoss

一致

torch.nn.NLLLoss

mindspore.nn.NLLLoss

差异对比

torch.nn.PReLU

mindspore.nn.PReLU

差异对比

torch.nn.PixelShuffle

mindspore.nn.PixelShuffle

一致

torch.nn.PixelUnshuffle

mindspore.nn.PixelUnshuffle

一致

torch.nn.PoissonNLLLoss

mindspore.nn.PoissonNLLLoss

一致

torch.nn.ReflectionPad1d

mindspore.nn.ReflectionPad1d

一致

torch.nn.ReflectionPad2d

mindspore.nn.ReflectionPad2d

一致

torch.nn.ReLU

mindspore.nn.ReLU

差异对比

torch.nn.ReLU6

mindspore.nn.ReLU6

一致

torch.nn.ReplicationPad1d

mindspore.nn.ReplicationPad1d

一致

torch.nn.ReplicationPad2d

mindspore.nn.ReplicationPad2d

一致

torch.nn.ReplicationPad3d

mindspore.nn.ReplicationPad3d

一致

torch.nn.RNN

mindspore.nn.RNN

差异对比

torch.nn.RNNCell

mindspore.nn.RNNCell

差异对比

torch.nn.RReLU

mindspore.nn.RReLU

一致

torch.nn.SeLU

mindspore.nn.SeLU

一致

torch.nn.Sequential

mindspore.nn.SequentialCell

差异对比

torch.nn.Sigmoid

mindspore.nn.Sigmoid

差异对比

torch.nn.SiLU

mindspore.nn.SiLU

一致

torch.nn.SmoothL1Loss

mindspore.nn.SmoothL1Loss

差异对比

torch.nn.SoftMarginLoss

mindspore.nn.SoftMarginLoss

一致

torch.nn.Softmax

mindspore.nn.Softmax

差异对比

torch.nn.Softmin

mindspore.nn.Softmin

差异对比

torch.nn.Softmax2d

mindspore.nn.Softmax2d

一致

torch.nn.Softshrink

mindspore.nn.SoftShrink

差异对比

torch.nn.Softsign

mindspore.nn.Softsign

一致

torch.nn.SyncBatchNorm

mindspore.nn.SyncBatchNorm

差异对比

torch.nn.Tanh

mindspore.nn.Tanh

差异对比

torch.nn.Tanhshrink

mindspore.nn.Tanhshrink

一致

torch.nn.Threshold

mindspore.nn.Threshold

一致

torch.nn.Transformer

mindspore.nn.Transformer

一致

torch.nn.TransformerDecoder

mindspore.nn.TransformerDecoder

一致

torch.nn.TransformerEncoder

mindspore.nn.TransformerEncoder

一致

torch.nn.TransformerDecoderLayer

mindspore.nn.TransformerDecoderLayer

一致

torch.nn.TransformerEncoderLayer

mindspore.nn.TransformerEncoderLayer

一致

torch.nn.TripletMarginLoss

mindspore.nn.TripletMarginLoss

功能一致,参数个数或顺序不一致比

torch.nn.Unflatten

mindspore.nn.Unflatten

一致

torch.nn.Unfold

mindspore.nn.Unfold

差异对比

torch.nn.Upsample

mindspore.nn.Upsample

差异对比

torch.nn.ZeroPad2d

mindspore.nn.ZeroPad2d

一致

torch.nn.functional

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.nn.functional.adaptive_avg_pool1d

mindspore.ops.adaptive_avg_pool1d

差异对比

torch.nn.functional.adaptive_avg_pool2d

mindspore.ops.adaptive_avg_pool2d

一致

torch.nn.functional.adaptive_avg_pool3d

mindspore.ops.adaptive_avg_pool3d

一致

torch.nn.functional.adaptive_max_pool1d

mindspore.ops.adaptive_max_pool1d

差异对比

torch.nn.functional.adaptive_max_pool2d

mindspore.ops.adaptive_max_pool2d

一致

torch.nn.functional.affine_grid

mindspore.ops.affine_grid

一致

torch.nn.functional.avg_pool1d

mindspore.ops.avg_pool1d

功能一致,参数名不同

torch.nn.functional.avg_pool2d

mindspore.ops.avg_pool2d

功能一致,参数名不同

torch.nn.functional.avg_pool3d

mindspore.ops.avg_pool3d

功能一致,参数名不同

torch.nn.functional.batch_norm

mindspore.ops.batch_norm

一致

torch.nn.functional.binary_cross_entropy

mindspore.ops.binary_cross_entropy

差异对比

torch.nn.functional.binary_cross_entropy_with_logits

mindspore.ops.binary_cross_entropy_with_logits

差异对比

torch.nn.functional.conv1d

mindspore.ops.conv1d

一致

torch.nn.functional.conv2d

mindspore.ops.conv2d

一致

torch.nn.functional.conv3d

mindspore.ops.conv3d

一致

torch.nn.functional.cosine_embedding_loss

mindspore.ops.cosine_embedding_loss

一致

torch.nn.functional.cosine_similarity

mindspore.ops.cosine_similarity

一致

torch.nn.functional.cross_entropy

mindspore.ops.cross_entropy

一致

torch.nn.functional.ctc_loss

mindspore.ops.ctc_loss

一致

torch.nn.functional.dropout

mindspore.ops.dropout

一致

torch.nn.functional.dropout2d

mindspore.ops.dropout2d

功能一致,数据类型不同

torch.nn.functional.dropout3d

mindspore.ops.dropout3d

功能一致,数据类型不同

torch.nn.functional.elu

mindspore.ops.elu

差异对比

torch.nn.functional.fold

mindspore.ops.fold

差异对比

torch.nn.functional.gelu

mindspore.ops.gelu

差异对比

torch.nn.functional.glu

mindspore.ops.glu

功能一致,参数名不同

torch.nn.functional.grid_sample

mindspore.ops.grid_sample

差异对比

torch.nn.functional.gumbel_softmax

mindspore.ops.gumbel_softmax

一致

torch.nn.functional.hardshrink

mindspore.ops.hardshrink

功能一致,参数名不同

torch.nn.functional.hardsigmoid

mindspore.ops.hardsigmoid

一致

torch.nn.functional.hardswish

mindspore.ops.hardswish

功能一致,参数名不同

torch.nn.functional.hardtanh

mindspore.ops.hardtanh

一致

torch.nn.functional.hinge_embedding_loss

mindspore.ops.hinge_embedding_loss

一致

torch.nn.functional.interpolate

mindspore.ops.interpolate

差异对比

torch.nn.functional.kl_div

mindspore.ops.kl_div

差异对比

torch.nn.functional.l1_loss

mindspore.ops.l1_loss

一致

torch.nn.functional.leaky_relu

mindspore.ops.leaky_relu

差异对比

torch.nn.functional.logsigmoid

mindspore.ops.logsigmoid

功能一致,参数名不同

torch.nn.functional.log_softmax

mindspore.ops.log_softmax

差异对比

torch.nn.functional.lp_pool1d

mindspore.ops.lp_pool1d

功能一致,参数名不同

torch.nn.functional.lp_pool2d

mindspore.ops.lp_pool2d

功能一致,参数名不同

torch.nn.functional.margin_ranking_loss

mindspore.ops.margin_ranking_loss

一致

torch.nn.functional.max_pool3d

mindspore.ops.max_pool3d

一致

torch.nn.functional.max_unpool1d

mindspore.ops.max_unpool1d

一致

torch.nn.functional.max_unpool2d

mindspore.ops.max_unpool2d

一致

torch.nn.functional.max_unpool3d

mindspore.ops.max_unpool3d

一致

torch.nn.functional.mse_loss

mindspore.ops.mse_loss

一致

torch.nn.functional.multi_margin_loss

mindspore.ops.multi_margin_loss

一致

torch.nn.functional.multilabel_margin_loss

mindspore.ops.multilabel_margin_loss

一致

torch.nn.functional.multilabel_soft_margin_loss

mindspore.ops.multilabel_soft_margin_loss

一致

torch.nn.functional.nll_loss

mindspore.ops.nll_loss

一致

torch.nn.functional.pad

mindspore.ops.pad

差异对比

torch.nn.functional.pdist

mindspore.ops.pdist

一致

torch.nn.functional.pixel_shuffle

mindspore.ops.pixel_shuffle

一致

torch.nn.functional.pixel_unshuffle

mindspore.ops.pixel_unshuffle

一致

torch.nn.functional.prelu

mindspore.ops.prelu

功能一致,参数名不同

torch.nn.functional.relu

mindspore.ops.relu

功能一致,参数名不同

torch.nn.functional.relu6

mindspore.ops.relu6

功能一致,参数名不同

torch.nn.functional.rrelu

mindspore.ops.rrelu

功能一致,参数名不同

torch.nn.functional.selu

mindspore.ops.selu

功能一致,参数名不同

torch.nn.functional.sigmoid

mindspore.ops.sigmoid

功能一致,参数名不同

torch.nn.functional.silu

mindspore.ops.silu

功能一致,参数名不同

torch.nn.functional.softmax

mindspore.ops.softmax

差异对比

torch.nn.functional.softmin

mindspore.ops.softmin

差异对比

torch.nn.functional.softsign

mindspore.ops.softsign

功能一致,参数名不同

torch.nn.functional.smooth_l1_loss

mindspore.ops.smooth_l1_loss

一致

torch.nn.functional.soft_margin_loss

mindspore.nn.SoftMarginLoss

差异对比

torch.nn.functional.softshrink

mindspore.ops.softshrink

功能一致,参数名不同

torch.nn.functional.tanh

mindspore.ops.tanh

功能一致,参数名不同

torch.nn.functional.tanhshrink

mindspore.ops.tanhshrink

一致

torch.nn.functional.threshold

mindspore.ops.threshold

功能一致,参数名不同

torch.nn.functional.triplet_margin_loss

mindspore.ops.triplet_margin_loss

功能一致,参数个数或顺序不一致

torch.nn.functional.upsample

mindspore.ops.upsample

差异对比

torch.nn.Module

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.nn.Module.apply

mindspore.nn.Cell.apply

一致

torch.nn.utils

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.nn.utils.clip_grad_value_

mindspore.ops.clip_by_value

差异对比

torch.Tensor

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.Tensor.abs

mindspore.Tensor.abs

一致

torch.Tensor.absolute

mindspore.Tensor.absolute

一致

torch.Tensor.acos

mindspore.Tensor.acos

一致

torch.Tensor.acosh

mindspore.Tensor.acosh

一致

torch.Tensor.add

mindspore.Tensor.add

一致

torch.Tensor.addbmm

mindspore.Tensor.addbmm

一致

torch.Tensor.addcdiv

mindspore.Tensor.addcdiv

一致

torch.Tensor.addcmul

mindspore.Tensor.addcmul

一致

torch.Tensor.addmm

mindspore.Tensor.addmm

一致

torch.Tensor.addmv

mindspore.Tensor.addmv

功能一致,参数名不同

torch.Tensor.addr

mindspore.Tensor.addr

一致

torch.Tensor.all

mindspore.Tensor.all

差异对比

torch.Tensor.amax

mindspore.Tensor.amax

差异对比

torch.Tensor.amin

mindspore.Tensor.amin

差异对比

torch.Tensor.any

mindspore.Tensor.any

差异对比

torch.Tensor.arccos

mindspore.Tensor.arccos

一致

torch.Tensor.arccosh

mindspore.Tensor.arccosh

一致

torch.Tensor.argmax

mindspore.Tensor.argmax

功能一致,参数名不同

torch.Tensor.angle

mindspore.Tensor.angle

一致

torch.Tensor.arcsin

mindspore.Tensor.arcsin

一致

torch.Tensor.arcsinh

mindspore.Tensor.arcsinh

一致

torch.Tensor.arctan

mindspore.Tensor.arctan

一致

torch.Tensor.arctanh

mindspore.Tensor.arctanh

一致

torch.Tensor.argmin

mindspore.Tensor.argmin

差异对比

torch.Tensor.argsort

mindspore.Tensor.argsort

一致

torch.Tensor.asin

mindspore.Tensor.asin

一致

torch.Tensor.asinh

mindspore.Tensor.asinh

一致

torch.Tensor.atan

mindspore.Tensor.atan

一致

torch.Tensor.atan2

mindspore.Tensor.atan2

一致

torch.Tensor.atanh

mindspore.Tensor.atanh

一致

torch.Tensor.baddbmm

mindspore.Tensor.baddbmm

一致

torch.Tensor.bernoulli

mindspore.Tensor.bernoulli

功能一致,参数个数或顺序不一致

torch.Tensor.bincount

mindspore.Tensor.bincount

一致

torch.Tensor.bitwise_and

mindspore.Tensor.bitwise_and

一致

torch.Tensor.bitwise_or

mindspore.Tensor.bitwise_or

一致

torch.Tensor.bitwise_xor

mindspore.Tensor.bitwise_xor

一致

torch.Tensor.bmm

mindspore.Tensor.bmm

功能一致,参数名不同

torch.Tensor.bool

mindspore.Tensor.bool

功能一致,参数名不同

torch.Tensor.broadcast_to

mindspore.Tensor.broadcast_to

差异对比

torch.Tensor.ceil

mindspore.Tensor.ceil

一致

torch.Tensor.chunk

mindspore.Tensor.chunk

一致

torch.Tensor.cholesky

mindspore.Tensor.cholesky

一致

torch.Tensor.cholesky_solve

mindspore.Tensor.cholesky_solve

一致

torch.Tensor.clamp

mindspore.Tensor.clamp

一致

torch.Tensor.clip

mindspore.Tensor.clip

一致

torch.Tensor.conj

mindspore.Tensor.conj

一致

torch.Tensor.copysign

mindspore.Tensor.copysign

一致

torch.Tensor.cos

mindspore.Tensor.cos

一致

torch.Tensor.cosh

mindspore.Tensor.cosh

一致

torch.Tensor.cross

mindspore.Tensor.cross

一致

torch.Tensor.cummax

mindspore.Tensor.cummax

功能一致,参数名不同

torch.Tensor.cummin

mindspore.Tensor.cummin

功能一致,参数名不同

torch.Tensor.cumprod

mindspore.Tensor.cumprod

一致

torch.Tensor.cumsum

mindspore.Tensor.cumsum

一致

torch.Tensor.deg2rad

mindspore.Tensor.deg2rad

一致

torch.Tensor.diag

mindspore.Tensor.diag

差异对比

torch.Tensor.diagflat

mindspore.Tensor.diagflat

一致

torch.Tensor.diagonal

mindspore.Tensor.diagonal

一致

torch.Tensor.diff

mindspore.Tensor.diff

功能一致,参数名不同

torch.Tensor.digamma

mindspore.Tensor.digamma

一致

torch.Tensor.dim

mindspore.Tensor.ndimension

一致

torch.Tensor.div

mindspore.Tensor.div

一致

torch.Tensor.divide

mindspore.Tensor.divide

一致

torch.Tensor.eq

mindspore.Tensor.equal

一致

torch.Tensor.erf

mindspore.Tensor.erf

一致

torch.Tensor.erfc

mindspore.Tensor.erfc

一致

torch.Tensor.erfinv

mindspore.Tensor.erfinv

一致

torch.Tensor.exp

mindspore.Tensor.exp

一致

torch.Tensor.expand_as

mindspore.Tensor.expand_as

功能一致,参数名不同

torch.Tensor.expm1

mindspore.Tensor.expm1

一致

torch.Tensor.flip

mindspore.Tensor.flip

一致

torch.Tensor.fliplr

mindspore.Tensor.fliplr

一致

torch.Tensor.flipud

mindspore.Tensor.flipud

一致

torch.Tensor.float

mindspore.Tensor.float

一致

torch.Tensor.float_power

mindspore.Tensor.float_power

差异对比

torch.Tensor.floor

mindspore.Tensor.floor

一致

torch.Tensor.fmod

mindspore.Tensor.fmod

一致

torch.Tensor.frac

mindspore.Tensor.frac

功能一致,参数名不同

torch.Tensor.gather

mindspore.Tensor.gather_elements

一致

torch.Tensor.ge

mindspore.Tensor.ge

功能一致,参数名不同

torch.Tensor.geqrf

mindspore.Tensor.geqrf

一致

torch.Tensor.ger

mindspore.Tensor.ger

差异对比

torch.Tensor.greater

mindspore.Tensor.greater

一致

torch.Tensor.greater_equal

mindspore.Tensor.greater_equal

一致

torch.Tensor.gt

mindspore.Tensor.gt

功能一致,参数名不同

torch.Tensor.H

mindspore.Tensor.H

一致

torch.Tensor.half

mindspore.Tensor.half

一致

torch.Tensor.hardshrink

mindspore.Tensor.hardshrink

一致

torch.Tensor.heaviside

mindspore.Tensor.heaviside

一致

torch.Tensor.histc

mindspore.Tensor.histc

一致

torch.Tensor.hypot

mindspore.Tensor.hypot

一致

torch.Tensor.i0

mindspore.Tensor.i0

一致

torch.Tensor.igamma

mindspore.Tensor.igamma

一致

torch.Tensor.igammac

mindspore.Tensor.igammac

一致

torch.Tensor.imag

mindspore.Tensor.imag

一致

torch.Tensor.index_add

mindspore.Tensor.index_add

一致

torch.Tensor.index_fill

mindspore.Tensor.index_fill

一致

torch.Tensor.index_put

mindspore.Tensor.index_put

一致

torch.Tensor.index_select

mindspore.Tensor.index_select

功能一致,参数名不同

torch.Tensor.inner

mindspore.Tensor.inner

功能一致,参数名不同

torch.Tensor.int

mindspore.Tensor.int

一致

torch.Tensor.inverse

mindspore.Tensor.inverse

一致

torch.Tensor.isclose

mindspore.Tensor.isclose

功能一致,参数名不同

torch.Tensor.isfinite

mindspore.Tensor.isfinite

一致

torch.Tensor.isinf

mindspore.Tensor.isinf

一致

torch.Tensor.isnan

mindspore.Tensor.isnan

一致

torch.Tensor.is_complex

mindspore.Tensor.is_complex

一致

torch.Tensor.is_floating_point

mindspore.Tensor.is_floating_point

一致

torch.Tensor.is_signed

mindspore.Tensor.is_signed

一致

torch.Tensor.isneginf

mindspore.Tensor.isneginf

一致

torch.Tensor.isposinf

mindspore.Tensor.isposinf

一致

torch.Tensor.isreal

mindspore.Tensor.isreal

一致

torch.Tensor.item

mindspore.Tensor.item

差异对比

torch.Tensor.lcm

mindspore.Tensor.lcm

一致

torch.Tensor.ldexp

mindspore.Tensor.ldexp

一致

torch.Tensor.le

mindspore.Tensor.le

一致

torch.Tensor.lerp

mindspore.Tensor.lerp

一致

torch.Tensor.less

mindspore.Tensor.less

一致

torch.Tensor.less_equal

mindspore.Tensor.less_equal

一致

torch.Tensor.log

mindspore.Tensor.log

一致

torch.Tensor.log10

mindspore.Tensor.log10

一致

torch.Tensor.log1p

mindspore.Tensor.log1p

一致

torch.Tensor.log2

mindspore.Tensor.log2

一致

torch.Tensor.logaddexp

mindspore.Tensor.logaddexp

一致

torch.Tensor.logaddexp2

mindspore.Tensor.logaddexp2

一致

torch.Tensor.logdet

mindspore.Tensor.logdet

一致

torch.Tensor.logical_and

mindspore.Tensor.logical_and

一致

torch.Tensor.logical_not

mindspore.Tensor.logical_not

一致

torch.Tensor.logical_or

mindspore.Tensor.logical_or

一致

torch.Tensor.logical_xor

mindspore.Tensor.logical_xor

一致

torch.Tensor.logit

mindspore.Tensor.logit

功能一致,参数名不同

torch.Tensor.logsumexp

mindspore.Tensor.logsumexp

一致

torch.Tensor.long

mindspore.Tensor.long

一致

torch.Tensor.lt

mindspore.Tensor.lt

一致

torch.Tensor.masked_fill

mindspore.Tensor.masked_fill

一致

torch.Tensor.masked_scatter

mindspore.Tensor.masked_scatter

差异对比

torch.Tensor.masked_select

mindspore.Tensor.masked_select

一致

torch.Tensor.matmul

mindspore.Tensor.matmul

一致

torch.Tensor.max

mindspore.Tensor.max

差异对比

torch.Tensor.maximum

mindspore.Tensor.maximum

一致

torch.Tensor.mean

mindspore.Tensor.mean

功能一致,参数名不同

torch.Tensor.median

mindspore.Tensor.median

差异对比

torch.Tensor.mH

mindspore.Tensor.mH

一致

torch.Tensor.min

mindspore.Tensor.min

差异对比

torch.Tensor.minimum

mindspore.Tensor.minimum

功能一致,参数名不同

torch.Tensor.mm

mindspore.Tensor.mm

一致

torch.Tensor.moveaxis

mindspore.Tensor.moveaxis

功能一致

torch.Tensor.movedim

mindspore.Tensor.movedim

一致

torch.Tensor.msort

mindspore.Tensor.msort

一致

torch.Tensor.mT

mindspore.Tensor.mT

一致

torch.Tensor.mul

mindspore.Tensor.mul

一致

torch.Tensor.multinomial

mindspore.Tensor.multinomial

功能一致,参数默认值不一致

torch.Tensor.multiply

mindspore.Tensor.multiply

一致

torch.Tensor.mvlgamma

mindspore.Tensor.mvlgamma

一致

torch.Tensor.nan_to_num

mindspore.Tensor.nan_to_num

功能一致,数据类型不同

torch.Tensor.nansum

mindspore.Tensor.nansum

一致

torch.Tensor.narrow

mindspore.Tensor.narrow

一致

torch.Tensor.ndim

mindspore.Tensor.ndim

一致

torch.Tensor.ndimension

mindspore.Tensor.ndimension

一致

torch.Tensor.ne

mindspore.Tensor.ne

一致

torch.Tensor.neg

mindspore.Tensor.neg

一致

torch.Tensor.negative

mindspore.Tensor.negative

一致

torch.Tensor.nelement

mindspore.Tensor.nelement

一致

torch.Tensor.new_ones

mindspore.Tensor.new_ones

一致

torch.Tensor.new_zeros

mindspore.Tensor.new_zeros

一致

torch.Tensor.nextafter

mindspore.Tensor.nextafter

一致

torch.Tensor.norm

mindspore.Tensor.norm

torch.Tensor.norm即将弃用,mindspore.Tensor.norm对标torch.linalg.norm,功能完全一致

torch.Tensor.nonzero

mindspore.Tensor.nonzero

一致

torch.Tensor.not_equal

mindspore.Tensor.not_equal

一致

torch.Tensor.numel

mindspore.Tensor.numel

一致

torch.Tensor.numpy

mindspore.Tensor.asnumpy

一致

torch.Tensor.ormqr

mindspore.Tensor.ormqr

一致

torch.Tensor.permute

mindspore.Tensor.permute

一致

torch.Tensor.pow

mindspore.Tensor.pow

功能一致,参数名不同

torch.Tensor.prod

mindspore.Tensor.prod

差异对比

torch.Tensor.ravel

mindspore.Tensor.ravel

一致

torch.Tensor.real

mindspore.Tensor.real

一致

torch.Tensor.reciprocal

mindspore.Tensor.reciprocal

一致

torch.Tensor.remainder

mindspore.Tensor.remainder

一致

torch.Tensor.renorm

mindspore.Tensor.renorm

功能一致,参数数据类型不一致

torch.Tensor.rad2deg

mindspore.Tensor.rad2deg

一致

torch.Tensor.repeat

mindspore.Tensor.tile

功能一致,参数名不同

torch.Tensor.repeat_interleave

mindspore.Tensor.repeat_interleave

一致

torch.Tensor.reshape

mindspore.Tensor.reshape

一致

torch.Tensor.reshape_as

mindspore.Tensor.reshape_as

一致

torch.Tensor.round

mindspore.Tensor.round

一致

torch.Tensor.rot90

mindspore.Tensor.rot90

一致

torch.Tensor.rsqrt

mindspore.Tensor.rsqrt

一致

torch.Tensor.scatter_

mindspore.ops.tensor_scatter_elements

差异对比

torch.Tensor.sum_to_size

mindspore.Tensor.sum_to_size

一致

torch.Tensor.scatter

mindspore.Tensor.scatter

差异对比

torch.Tensor.sgn

mindspore.Tensor.sgn

一致

torch.Tensor.short

mindspore.Tensor.short

一致

torch.Tensor.sigmoid

mindspore.Tensor.sigmoid

一致

torch.Tensor.sign

mindspore.Tensor.sign

一致

torch.Tensor.signbit

mindspore.Tensor.signbit

一致

torch.Tensor.sin

mindspore.Tensor.sin

一致

torch.Tensor.sinc

mindspore.Tensor.sinc

一致

torch.Tensor.sinh

mindspore.Tensor.sinh

一致

torch.Tensor.size

mindspore.Tensor.shape

一致

torch.Tensor.slogdet

mindspore.Tensor.slogdet

一致

torch.Tensor.sort

mindspore.Tensor.sort

一致

torch.Tensor.split

mindspore.Tensor.split

功能一致,参数名不同

torch.Tensor.sqrt

mindspore.Tensor.sqrt

一致

torch.Tensor.square

mindspore.Tensor.square

一致

torch.Tensor.squeeze

mindspore.Tensor.squeeze

一致

torch.Tensor.std

mindspore.Tensor.std

差异对比

torch.Tensor.sub

mindspore.Tensor.subtract

一致

torch.Tensor.subtract

mindspore.Tensor.subtract

一致

torch.Tensor.svd

mindspore.Tensor.svd

差异对比

torch.Tensor.swapaxes

mindspore.Tensor.swapaxes

一致

torch.Tensor.swapdims

mindspore.Tensor.swapdims

一致

torch.Tensor.T

mindspore.Tensor.T

一致

torch.Tensor.t

mindspore.Tensor.t

一致

torch.Tensor.take

mindspore.Tensor.take

一致

torch.Tensor.tan

mindspore.Tensor.tan

一致

torch.Tensor.tanh

mindspore.Tensor.tanh

一致

torch.Tensor.trace

mindspore.Tensor.trace

一致

torch.Tensor.transpose

mindspore.Tensor.swapaxes

一致

torch.Tensor.tile

mindspore.Tensor.tile

功能一致,参数名不同

torch.Tensor.to

mindspore.Tensor.to

功能一致,参数名不同

torch.Tensor.topk

mindspore.Tensor.topk

一致

torch.Tensor.tril

mindspore.Tensor.tril

功能一致,参数名不同

torch.Tensor.tensor_split

mindspore.Tensor.tensor_split

一致

torch.Tensor.true_divide

mindspore.Tensor.true_divide

一致

torch.Tensor.trunc

mindspore.Tensor.trunc

一致

torch.Tensor.unbind

mindspore.Tensor.unbind

一致

torch.Tensor.unique_consecutive

mindspore.Tensor.unique_consecutive

一致

torch.Tensor.unsqueeze

mindspore.Tensor.unsqueeze

一致

torch.Tensor.var

mindspore.Tensor.var

差异对比

torch.Tensor.view

mindspore.Tensor.view

一致

torch.Tensor.view_as

mindspore.Tensor.view_as

一致

torch.Tensor.where

mindspore.Tensor.where

一致

torch.Tensor.xlogy

mindspore.Tensor.xlogy

功能一致,参数名不同

torch.optim

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.optim.lr_scheduler.CosineAnnealingLR

mindspore.nn.cosine_decay_lr

差异对比

torch.optim.lr_scheduler.ExponentialLR

mindspore.nn.exponential_decay_lr

差异对比

torch.optim.lr_scheduler.MultiStepLR

mindspore.nn.piecewise_constant_lr

差异对比

torch.optim.lr_scheduler.StepLR

mindspore.nn.piecewise_constant_lr

差异对比

torch.utils

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.utils.data.DataLoader

None

差异对比

torch.utils.data.Dataset

mindspore.dataset.GeneratorDataset

差异对比

torch.utils.data.distributed.DistributedSampler

mindspore.dataset.DistributedSampler

torch.utils.data.RandomSampler

mindspore.dataset.RandomSampler

torch.utils.data.SequentialSampler

mindspore.dataset.SequentialSampler

torch.utils.data.SubsetRandomSampler

mindspore.dataset.SubsetRandomSampler

torch.utils.data.WeightedRandomSampler

mindspore.dataset.WeightedRandomSampler

torchtext

TorchText 0.10.0 APIs

MindSpore APIs

说明

torchtext.data.functional.custom_replace

mindspore.dataset.text.RegexReplace

torchtext.data.functional.load_sp_model

mindspore.dataset.text.SentencePieceVocab

差异对比

torchtext.data.functional.numericalize_tokens_from_iterator

mindspore.dataset.text.Lookup

差异对比

torchtext.data.functional.sentencepiece_numericalizer

mindspore.dataset.text.SentencePieceTokenizer

差异对比

torchtext.data.functional.sentencepiece_tokenizer

mindspore.dataset.text.SentencePieceTokenizer

差异对比

torchtext.data.functional.simple_space_split

mindspore.dataset.text.WhitespaceTokenizer

torchtext.data.utils.ngrams_iterator

mindspore.dataset.text.Ngram

差异对比

torchvision

TorchVision 0.10.0 APIs

MindSpore APIs

说明

torchvision.datasets.CelebA

mindspore.dataset.CelebADataset

torchvision.datasets.CIFAR10

mindspore.dataset.Cifar10Dataset

torchvision.datasets.CIFAR100

mindspore.dataset.Cifar100Dataset

torchvision.datasets.CocoDetection

mindspore.dataset.CocoDataset

差异对比

torchvision.datasets.ImageFolder

mindspore.dataset.ImageFolderDataset

torchvision.datasets.MNIST

mindspore.dataset.MnistDataset

torchvision.datasets.VOCDetection

mindspore.dataset.VOCDataset

差异对比

torchvision.datasets.VOCSegmentation

mindspore.dataset.VOCDataset

差异对比

torchvision.ops.nms

mindspore.ops.NMSWithMask

torchvision.ops.roi_align

mindspore.ops.ROIAlign

torchvision.transforms.CenterCrop

mindspore.dataset.vision.CenterCrop

torchvision.transforms.ColorJitter

mindspore.dataset.vision.RandomColorAdjust

torchvision.transforms.Compose

mindspore.dataset.transforms.Compose

torchvision.transforms.ConvertImageDtype

mindspore.dataset.transforms.TypeCast

差异对比

torchvision.transforms.FiveCrop

mindspore.dataset.vision.FiveCrop

torchvision.transforms.GaussianBlur

mindspore.dataset.vision.GaussianBlur

torchvision.transforms.Grayscale

mindspore.dataset.vision.Grayscale

torchvision.transforms.LinearTransformation

mindspore.dataset.vision.LinearTransformation

torchvision.transforms.Normalize

mindspore.dataset.vision.Normalize

torchvision.transforms.Pad

mindspore.dataset.vision.Pad

torchvision.transforms.RandomAffine

mindspore.dataset.vision.RandomAffine

torchvision.transforms.RandomApply

mindspore.dataset.transforms.RandomApply

torchvision.transforms.RandomChoice

mindspore.dataset.transforms.RandomChoice

torchvision.transforms.RandomCrop

mindspore.dataset.vision.RandomCrop

torchvision.transforms.RandomErasing

mindspore.dataset.vision.RandomErasing

torchvision.transforms.RandomGrayscale

mindspore.dataset.vision.RandomGrayscale

torchvision.transforms.RandomHorizontalFlip

mindspore.dataset.vision.RandomHorizontalFlip

torchvision.transforms.RandomOrder

mindspore.dataset.transforms.RandomOrder

torchvision.transforms.RandomPerspective

mindspore.dataset.vision.RandomPerspective

torchvision.transforms.RandomPosterize

mindspore.dataset.vision.RandomPosterize

torchvision.transforms.RandomResizedCrop

mindspore.dataset.vision.RandomResizedCrop

torchvision.transforms.RandomRotation

mindspore.dataset.vision.RandomRotation

torchvision.transforms.RandomSolarize

mindspore.dataset.vision.RandomSolarize

差异对比

torchvision.transforms.RandomVerticalFlip

mindspore.dataset.vision.RandomVerticalFlip

torchvision.transforms.Resize

mindspore.dataset.vision.Resize

torchvision.transforms.TenCrop

mindspore.dataset.vision.TenCrop

torchvision.transforms.ToPILImage

mindspore.dataset.vision.ToPIL

差异对比

torchvision.transforms.ToTensor

mindspore.dataset.vision.ToTensor

差异对比

TorchVision 0.14.0 APIs

MindSpore APIs

说明

torchvision.ops.deform_conv2d

mindspore.ops.deformable_conv2d

差异对比