PyTorch and MindSpore API Mapping Table

View Source On Gitee

Mapping between TensorFlow APIs and MindSpore APIs, which is provided by the community. There may be differences in parameters, inputs, outputs, logic functions, and specific scenarios. For details, see the description of each API or the difference comparison provided.

More MindSpore developers are also welcome to participate in improving the mapping content.

General Difference Parameter Table

Because of the framework mechanism, MindSpore does not provide the following parameters for PyTorch:

Parameter Names

Functions

out

Indicates the output Tensor

layout

Indicates the memory distribution strategy

device

Indicates the Tensor storage location

requires_grad

Indicates whether to update the gradient

generator

Indicates a generator for pseudorandom number

pin_memory

Indicates whether to use locking page memory

memory_format

Indicates the memory format of the Tensor

stable

Indicates whether the sorting is stable

inplace

Indicates that the value of a variable is modified directly without changing the memory address of the variable

sparse_grad

Indicates whether to perform sparsification on the gradient

size_average

The deprecated parameter in PyTorch

reduce

The deprecated parameter in PyTorch

PyTorch 1.8.1

torch

PyTorch 1.8.1 APIs

MindSpore APIs

Descriptions

torch.abs

mindspore.ops.abs

Consistent

torch.absolute

mindspore.ops.absolute

Consistent

torch.acos

mindspore.ops.acos

Consistent

torch.acosh

mindspore.ops.acosh

Consistent

torch.add

mindspore.ops.add

Consistent

torch.addbmm

mindspore.ops.addbmm

Consistent

torch.addcdiv

mindspore.ops.addcdiv

Consistent

torch.addcmul

mindspore.ops.addcmul

Consistent

torch.addmm

mindspore.ops.addmm

Consistent

torch.addmv

mindspore.ops.addmv

The functions are consistent, but the parameter names are inconsistent.

torch.addr

mindspore.ops.addr

The functions are consistent, but the parameter names are inconsistent.

torch.all

mindspore.ops.all

diff

torch.amax

mindspore.ops.amax

diff

torch.amin

mindspore.ops.amin

diff

torch.angle

mindspore.ops.angle

Consistent

torch.any

mindspore.ops.any

diff

torch.arange

mindspore.ops.arange

Consistent

torch.arccos

mindspore.ops.arccos

Consistent

torch.arccosh

mindspore.ops.arccosh

Consistent

torch.arcsin

mindspore.ops.arcsin

The functions are consistent, but the parameter names are inconsistent.

torch.arcsinh

mindspore.ops.arcsinh

The functions are consistent, but the parameter names are inconsistent.

torch.arctan

mindspore.ops.arctan

Consistent

torch.arctanh

mindspore.ops.arctanh

The functions are consistent, but the parameter names are inconsistent.

torch.argmax

mindspore.ops.argmax

Consistent

torch.argmin

mindspore.ops.argmin

diff

torch.argsort

mindspore.ops.argsort

Consistent

torch.asin

mindspore.ops.asin

Consistent

torch.asinh

mindspore.ops.asinh

Consistent

torch.atan

mindspore.ops.atan

Consistent

torch.atan2

mindspore.ops.atan2

Consistent

torch.atanh

mindspore.ops.atanh

Consistent

torch.atleast_1d

mindspore.ops.atleast_1d

The functions are consistent, but the parameter names are inconsistent.

torch.atleast_2d

mindspore.ops.atleast_2d

The functions are consistent, but the parameter names are inconsistent.

torch.atleast_3d

mindspore.ops.atleast_3d

The functions are consistent, but the parameter names are inconsistent.

torch.baddbmm

mindspore.ops.baddbmm

Consistent

torch.bartlett_window

mindspore.ops.bartlett_window

diff

torch.bernoulli

mindspore.ops.bernoulli

The functions are consistent, but the number or sequence of parameters is inconsistent.

torch.bincount

mindspore.ops.bincount

Consistent

torch.bitwise_and

mindspore.ops.bitwise_and

Consistent

torch.bitwise_or

mindspore.ops.bitwise_or

Consistent

torch.bitwise_xor

mindspore.ops.bitwise_xor

Consistent

torch.blackman_window

mindspore.ops.blackman_window

diff

torch.block_diag

mindspore.ops.block_diag

The functions are consistent, but the parameter names are inconsistent.

torch.bmm

mindspore.ops.bmm

The functions are consistent, but the parameter names are inconsistent.

torch.broadcast_to

mindspore.ops.broadcast_to

diff

torch.cat

mindspore.ops.cat

diff

torch.cdist

mindspore.ops.cdist

diff

torch.ceil

mindspore.ops.ceil

Consistent

torch.cholesky

mindspore.ops.cholesky

The functions are consistent, but the parameter names are inconsistent.

torch.cholesky_solve

mindspore.ops.cholesky_solve

Consistent

torch.chunk

mindspore.ops.chunk

Consistent

torch.clamp

mindspore.ops.clamp

Consistent

torch.clip

mindspore.ops.clip

Consistent

torch.column_stack

mindspore.ops.column_stack

Consistent

torch.combinations

mindspore.ops.combinations

The functions are consistent, but the parameter names are inconsistent.

torch.conj

mindspore.ops.conj

Consistent

torch.copysign

mindspore.ops.copysign

The functions are consistent, but the parameter names are inconsistent.

torch.cos

mindspore.ops.cos

Consistent

torch.cosh

mindspore.ops.cosh

Consistent

torch.count_nonzero

mindspore.ops.count_nonzero

Consistent

torch.cross

mindspore.ops.cross

Consistent

torch.cummax

mindspore.ops.cummax

Consistent

torch.cummin

mindspore.ops.cummin

Consistent

torch.cumprod

mindspore.ops.cumprod

Consistent

torch.cumsum

mindspore.ops.cumsum

diff

torch.deg2rad

mindspore.ops.deg2rad

The functions are consistent, but the parameter names are inconsistent.

torch.diag

mindspore.ops.diag

diff

torch.diag_embed

mindspore.ops.diag_embed

Consistent

torch.diagflat

mindspore.ops.diagflat

Consistent

torch.diagonal

mindspore.ops.diagonal

Consistent

torch.diff

mindspore.ops.diff

The functions are consistent, but the parameter names are inconsistent.

torch.digamma

mindspore.ops.digamma

Consistent

torch.dist

mindspore.ops.dist

Consistent

torch.div

mindspore.ops.div

Consistent

torch.divide

mindspore.ops.divide

Consistent

torch.dot

mindspore.ops.tensor_dot

diff

torch.dstack

mindspore.ops.dstack

The functions are consistent, but the parameter names are inconsistent.

torch.empty

mindspore.numpy.empty

diff

torch.empty_like

mindspore.numpy.empty_like

diff

torch.einsum

mindspore.ops.einsum

Consistent

torch.eq

mindspore.ops.equal

Consistent

torch.erf

mindspore.ops.erf

Consistent

torch.erfc

mindspore.ops.erfc

Consistent

torch.erfinv

mindspore.ops.erfinv

Consistent

torch.exp

mindspore.ops.exp

Consistent

torch.exp2

mindspore.ops.exp2

Consistent

torch.expm1

mindspore.ops.expm1

Consistent

torch.eye

mindspore.ops.eye

Consistent

torch.flatten

mindspore.ops.flatten

diff

torch.float_power

mindspore.ops.float_power

diff

torch.flip

mindspore.ops.flip

Consistent

torch.fliplr

mindspore.ops.fliplr

Consistent

torch.flipud

mindspore.ops.flipud

Consistent

torch.floor

mindspore.ops.floor

Consistent

torch.fmax

mindspore.ops.fmax

Consistent

torch.fmod

mindspore.ops.fmod

Consistent

torch.frac

mindspore.ops.frac

The functions are consistent, but the parameter names are inconsistent.

torch.full

mindspore.ops.full

diff

torch.full_like

mindspore.ops.full_like

Consistent

torch.gather

mindspore.ops.gather_elements

Consistent

torch.gcd

mindspore.ops.gcd

Consistent

torch.ge

mindspore.ops.ge

The functions are consistent, but the parameter names are inconsistent.

torch.geqrf

mindspore.ops.geqrf

Consistent

torch.ger

mindspore.ops.ger

diff

torch.greater

mindspore.ops.greater

Consistent

torch.greater_equal

mindspore.ops.greater_equal

Consistent

torch.gt

mindspore.ops.gt

The functions are consistent, but the parameter names are inconsistent.

torch.hann_window

mindspore.numpy.hanning

diff

torch.hann_window

mindspore.ops.hann_window

Consistent

torch.heaviside

mindspore.ops.heaviside

Consistent

torch.hstack

mindspore.ops.hstack

Consistent

torch.histc

mindspore.ops.histc

Consistent

torch.hypot

mindspore.ops.hypot

Consistent

torch.hamming_window

mindspore.ops.hamming_window

Consistent

torch.i0

mindspore.ops.i0

Consistent

torch.igamma

mindspore.ops.igamma

Consistent

torch.igammac

mindspore.ops.igammac

Consistent

torch.imag

mindspore.ops.imag

Consistent

torch.index_select

mindspore.ops.index_select

The functions are consistent, but the parameter names are inconsistent.

torch.inner

mindspore.ops.inner

Consistent

torch.inverse

mindspore.ops.inverse

Consistent

torch.isclose

mindspore.ops.isclose

The functions are consistent, but the parameter names are inconsistent.

torch.isfinite

mindspore.ops.isfinite

Consistent

torch.isinf

mindspore.ops.isinf

Consistent

torch.isnan

mindspore.ops.isnan

Consistent

torch.isneginf

mindspore.ops.isneginf

Consistent

torch.isposinf

mindspore.ops.isposinf

Consistent

torch.isreal

mindspore.ops.isreal

Consistent

torch.is_complex

mindspore.ops.is_complex

The functions are consistent, but the parameter names are inconsistent.

torch.is_floating_point

mindspore.ops.is_floating_point

The functions are consistent, but the parameter names are inconsistent.

torch.is_tensor

mindspore.ops.is_tensor

Consistent

torch.kaiser_window

mindspore.ops.kaiser_window

Consistent

torch.kron

mindspore.ops.kron

The functions are consistent, but the parameter names are inconsistent.

torch.lcm

mindspore.ops.lcm

Consistent

torch.ldexp

mindspore.ops.ldexp

The functions are consistent, but the parameter names are inconsistent.

torch.le

mindspore.ops.le

The functions are consistent, but the parameter names are inconsistent.

torch.lerp

mindspore.ops.lerp

The functions are consistent, but the parameter names are inconsistent.

torch.less

mindspore.ops.less

The functions are consistent, but the parameter names are inconsistent.

torch.less_equal

mindspore.ops.less_equal

The functions are consistent, but the parameter names are inconsistent.

torch.linalg.norm

mindspore.ops.norm

Consistent

torch.linspace

mindspore.ops.linspace

Consistent

torch.log

mindspore.ops.log

Consistent

torch.log2

mindspore.ops.log2

Consistent

torch.log10

mindspore.ops.log10

Consistent

torch.logaddexp

mindspore.ops.logaddexp

Consistent

torch.logaddexp2

mindspore.ops.logaddexp2

Consistent

torch.log1p

mindspore.ops.log1p

The functions are consistent, but the parameter names are inconsistent.

torch.logdet

mindspore.ops.logdet

Consistent

torch.logical_and

mindspore.ops.logical_and

Consistent

torch.logical_not

mindspore.ops.logical_not

Consistent

torch.logical_or

mindspore.ops.logical_or

Consistent

torch.logical_xor

mindspore.ops.logical_xor

Consistent

torch.logit

mindspore.ops.logit

Consistent

torch.logspace

mindspore.ops.logspace

Consistent

torch.logsumexp

mindspore.ops.logsumexp

Consistent

torch.lt

mindspore.ops.lt

Consistent

torch.masked_select

mindspore.ops.masked_select

Consistent

torch.matmul

mindspore.ops.matmul

Consistent

torch.max

mindspore.ops.max

diff

torch.maximum

mindspore.ops.maximum

The functions are consistent, but the parameter names are inconsistent.

torch.mean

mindspore.ops.mean

The functions are consistent, but the parameter names are inconsistent.

torch.median

mindspore.ops.median

diff

torch.meshgrid

mindspore.ops.meshgrid

diff

torch.mm

mindspore.ops.mm

Consistent

torch.mul

mindspore.ops.mul

The functions are consistent, but the parameter names are inconsistent.

torch.min

mindspore.ops.min

diff

torch.minimum

mindspore.ops.minimum

The functions are consistent, but the parameter names are inconsistent.

torch.msort

mindspore.ops.msort

Consistent

torch.moveaxis

mindspore.ops.moveaxis

Consistent

torch.movedim

mindspore.ops.movedim

Consistent

torch.multinomial

mindspore.ops.multinomial

The functions are consistent, but the parameter default values are inconsistent.

torch.multiply

mindspore.ops.multiply

Consistent

torch.mv

mindspore.ops.mv

The functions are consistent, but the parameter names are inconsistent.

torch.mvlgamma

mindspore.ops.mvlgamma

Consistent

torch.nan_to_num

mindspore.ops.nan_to_num

Consistent

torch.nansum

mindspore.ops.nansum

Consistent

torch.narrow

mindspore.ops.narrow

Consistent

torch.ne

mindspore.ops.ne

The functions are consistent, but the parameter names are inconsistent.

torch.neg

mindspore.ops.neg

Consistent

torch.negative

mindspore.ops.negative

Consistent

torch.nextafter

mindspore.ops.nextafter

Consistent

torch.nonzero

mindspore.ops.nonzero

The functions are consistent, but the parameter names are inconsistent.

torch.normal

mindspore.ops.normal

The functions are consistent, but the number or sequence of parameters is inconsistent.

torch.not_equal

mindspore.ops.not_equal

Consistent

torch.numel

mindspore.ops.numel

Consistent

torch.ones

mindspore.ops.ones

diff

torch.ones_like

mindspore.ops.ones_like

Consistent

torch.orgqr

mindspore.ops.orgqr

Consistent

torch.ormqr

mindspore.ops.ormqr

Consistent

torch.outer

mindspore.ops.outer

The functions are consistent, but the parameter names are inconsistent.

torch.poisson

mindspore.ops.random_poisson

diff

torch.polar

mindspore.ops.polar

Consistent

torch.polygamma

mindspore.ops.polygamma

Consistent

torch.pow

mindspore.ops.pow

The functions are consistent, but the parameter names are inconsistent.

torch.prod

mindspore.ops.prod

diff

torch.rad2deg

mindspore.ops.rad2deg

The functions are consistent, but the parameter names are inconsistent.

torch.rand

mindspore.ops.rand

Consistent

torch.rand_like

mindspore.ops.rand_like

Consistent

torch.randn

mindspore.ops.randn

Consistent

torch.randn_like

mindspore.ops.randn_like

Consistent

torch.randint

mindspore.ops.randint

diff

torch.randint_like

mindspore.ops.randint_like

diff

torch.randperm

mindspore.ops.randperm

The functions are consistent, but the parameter names are inconsistent.

torch.range

mindspore.ops.range

diff

torch.ravel

mindspore.ops.ravel

Consistent

torch.real

mindspore.ops.real

Consistent

torch.reciprocal

mindspore.ops.reciprocal

Consistent

torch.remainder

mindspore.ops.remainder

Consistent

torch.renorm

mindspore.ops.renorm

diff

torch.repeat_interleave

mindspore.ops.repeat_interleave

The functions are consistent, but the parameter names are inconsistent.

torch.reshape

mindspore.ops.reshape

Consistent

torch.rot90

mindspore.ops.rot90

Consistent

torch.round

mindspore.ops.round

Consistent

torch.rsqrt

mindspore.ops.rsqrt

Consistent

torch.searchsorted

mindspore.ops.searchsorted

Consistent

torch.scatter

mindspore.ops.scatter

diff

torch.scatter_add

mindspore.ops.tensor_scatter_elements

diff

torch.sgn

mindspore.ops.sgn

Consistent

torch.sigmoid

mindspore.ops.sigmoid

Consistent

torch.sign

mindspore.ops.sign

Consistent

torch.signbit

mindspore.ops.signbit

Consistent

torch.sin

mindspore.ops.sin

Consistent

torch.sinc

mindspore.ops.sinc

Consistent

torch.sinh

mindspore.ops.sinh

Consistent

torch.slogdet

mindspore.ops.slogdet

Consistent

torch.sort

mindspore.ops.sort

The functions are consistent, but the parameter names are inconsistent.

torch.split

mindspore.ops.split

The functions are consistent, but the parameter names are inconsistent.

torch.stack

mindspore.ops.stack

Consistent

torch.squeeze

mindspore.ops.squeeze

The functions are consistent, but the parameter names are inconsistent.

torch.std

mindspore.ops.std

diff

torch.std_mean

mindspore.ops.std_mean

diff

torch.sqrt

mindspore.ops.sqrt

The functions are consistent, but the parameter names are inconsistent.

torch.square

mindspore.ops.square

Consistent

torch.sub

mindspore.ops.subtract

The functions are consistent, but the parameter names are inconsistent.

torch.subtract

mindspore.ops.subtract

Consistent

torch.sum

mindspore.ops.sum

The functions are consistent, but the parameter names are inconsistent.

torch.svd

mindspore.ops.svd

diff

torch.swapaxes

mindspore.ops.swapaxes

Consistent

torch.swapdims

mindspore.ops.swapdims

Consistent

torch.t

mindspore.ops.t

Consistent

torch.tan

mindspore.ops.tan

Consistent

torch.tanh

mindspore.ops.tanh

Consistent

torch.tensor_split

mindspore.ops.tensor_split

Consistent

torch.tile

mindspore.ops.tile

The functions are consistent, but the parameter names are inconsistent.

torch.topk

mindspore.ops.topk

Consistent

torch.trace

mindspore.ops.trace

Consistent

torch.transpose

mindspore.ops.swapaxes

Consistent

torch.trapz

mindspore.ops.trapz

Consistent

torch.tril

mindspore.ops.tril

Consistent

torch.tril_indices

mindspore.ops.tril_indices

Consistent

torch.triu_indices

mindspore.ops.triu_indices

Consistent

torch.true_divide

mindspore.ops.true_divide

Consistent

torch.trunc

mindspore.ops.trunc

Consistent

torch.unbind

mindspore.ops.unbind

Consistent

torch.unique

mindspore.ops.unique

diff

torch.unique_consecutive

mindspore.ops.unique_consecutive

Consistent

torch.unsqueeze

mindspore.ops.unsqueeze

Consistent

torch.var

mindspore.ops.var

diff

torch.var_mean

mindspore.ops.var_mean

diff

torch.view_as_real

mindspore.ops.view_as_real

Consistent

torch.vstack

mindspore.ops.vstack

The functions are consistent, but the parameter names are inconsistent.

torch.where

mindspore.ops.where

Consistent

torch.xlogy

mindspore.ops.xlogy

Consistent

torch.zeros

mindspore.ops.zeros

diff

torch.zeros_like

mindspore.ops.zeros_like

Consistent

torch.distributions

PyTorch 1.8.1 APIs

MindSpore APIs

Descriptions

torch.distributions.laplace.Laplace

mindspore.ops.standard_laplace

diff

torch.distributed

PyTorch 1.8.1 APIs

MindSpore APIs

Descriptions

torch.distributed.all_gather

mindspore.ops.AllGather

diff

torch.distributed.all_reduce

mindspore.ops.AllReduce

diff

torch.distributed.get_rank

mindspore.communication.get_rank

diff

torch.distributed.init_process_group

mindspore.communication.init

diff

torch.distributed.new_group

mindspore.communication.create_group

diff

torch.nn

PyTorch 1.8.1 APIs

MindSpore APIs

Descriptions

torch.nn.AdaptiveAvgPool1d

mindspore.nn.AdaptiveAvgPool1d

diff

torch.nn.AdaptiveAvgPool2d

mindspore.nn.AdaptiveAvgPool2d

Consistent

torch.nn.AdaptiveAvgPool3d

mindspore.nn.AdaptiveAvgPool3d

Consistent

torch.nn.AdaptiveMaxPool1d

mindspore.nn.AdaptiveMaxPool1d

diff

torch.nn.AdaptiveMaxPool2d

mindspore.nn.AdaptiveMaxPool2d

Consistent

torch.nn.AdaptiveMaxPool3d

mindspore.nn.AdaptiveMaxPool3d

Consistent

torch.nn.AvgPool1d

mindspore.nn.AvgPool1d

diff

torch.nn.AvgPool2d

mindspore.nn.AvgPool2d

diff

torch.nn.AvgPool3d

mindspore.nn.AvgPool3d

diff

torch.nn.BCEWithLogitsLoss

mindspore.nn.BCEWithLogitsLoss

diff

torch.nn.BatchNorm1d

mindspore.nn.BatchNorm1d

diff

torch.nn.BatchNorm2d

mindspore.nn.BatchNorm2d

diff

torch.nn.BatchNorm3d

mindspore.nn.BatchNorm3d

diff

torch.nn.Bilinear

mindspore.nn.BiDense

diff

torch.nn.CeLU

mindspore.nn.CELU

Consistent

torch.nn.ChannelShuffle

mindspore.nn.ChannelShuffle

Consistent

torch.nn.CTCLoss

mindspore.nn.CTCLoss

Consistent

torch.nn.ConstantPad1d

mindspore.nn.ConstantPad1d

Consistent

torch.nn.ConstantPad2d

mindspore.nn.ConstantPad2d

Consistent

torch.nn.ConstantPad3d

mindspore.nn.ConstantPad3d

Consistent

torch.nn.Conv1d

mindspore.nn.Conv1d

diff

torch.nn.Conv2d

mindspore.nn.Conv2d

diff

torch.nn.Conv3d

mindspore.nn.Conv3d

diff

torch.nn.ConvTranspose1d

mindspore.nn.Conv1dTranspose

diff

torch.nn.ConvTranspose2d

mindspore.nn.Conv2dTranspose

diff

torch.nn.ConvTranspose3d

mindspore.nn.Conv3dTranspose

diff

torch.nn.CosineEmbeddingLoss

mindspore.nn.CosineEmbeddingLoss

diff

torch.nn.CrossEntropyLoss

mindspore.nn.CrossEntropyLoss

diff

torch.nn.Dropout

mindspore.nn.Dropout

diff

torch.nn.Dropout2d

mindspore.nn.Dropout2d

Consistent

torch.nn.Dropout3d

mindspore.nn.Dropout3d

Consistent

torch.nn.ELU

mindspore.nn.ELU

Consistent

torch.nn.GaussianNLLLoss

mindspore.nn.GaussianNLLLoss

diff

torch.nn.GELU

mindspore.nn.GELU

diff

torch.nn.GRU

mindspore.nn.GRU

diff

torch.nn.GRUCell

mindspore.nn.GRUCell

diff

torch.nn.GroupNorm

mindspore.nn.GroupNorm

diff

torch.nn.Hardshrink

mindspore.nn.HShrink

diff

torch.nn.Hardsigmoid

mindspore.nn.Hsigmoid

Cosistent

torch.nn.Hardswish

mindspore.nn.Hswish

Consistent

torch.nn.Hardtanh

mindspore.nn.Hardtanh

Consistent

torch.nn.HingeEmbeddingLoss

mindspore.nn.HingeEmbeddingLoss

Consistent

torch.nn.Identity

mindspore.nn.Identity

The functions are consistent, but the parameter names are inconsistent.

torch.nn.init.uniform_

mindspore.ops.uniform

diff

torch.nn.InstanceNorm1d

mindspore.nn.InstanceNorm1d

diff

torch.nn.InstanceNorm2d

mindspore.nn.InstanceNorm2d

diff

torch.nn.InstanceNorm3d

mindspore.nn.InstanceNorm3d

diff

torch.nn.L1Loss

mindspore.nn.L1Loss

diff

torch.nn.KLDivLoss

mindspore.nn.KLDivLoss

Consistent

torch.nn.LayerNorm

mindspore.nn.LayerNorm

diff

torch.nn.LeakyReLU

mindspore.nn.LeakyReLU

diff

torch.nn.LPPool1d

mindspore.nn.LPPool1d

Consistent

torch.nn.LPPool2d

mindspore.nn.LPPool2d

Consistent

torch.nn.LSTM

mindspore.nn.LSTM

diff

torch.nn.LSTMCell

mindspore.nn.LSTMCell

diff

torch.nn.Linear

mindspore.nn.Dense

diff

torch.nn.LocalResponseNorm

mindspore.ops.LRN

diff

torch.nn.LogSigmoid

mindspore.nn.LogSigmoid

Consistent

torch.nn.MSELoss

mindspore.nn.MSELoss

diff

torch.nn.MarginRankingLoss

mindspore.nn.MarginRankingLoss

Consistent

torch.nn.MaxPool1d

mindspore.nn.MaxPool1d

diff

torch.nn.MaxPool2d

mindspore.nn.MaxPool2d

diff

torch.nn.MaxPool3d

mindspore.nn.MaxPool3d

diff

torch.nn.MaxUnpool1d

mindspore.nn.MaxUnpool1d

Consistent

torch.nn.MaxUnpool2d

mindspore.nn.MaxUnpool2d

Consistent

torch.nn.MaxUnpool3d

mindspore.nn.MaxUnpool3d

Consistent

torch.nn.MultiheadAttention

mindspore.nn.MultiheadAttention

Consistent

torch.nn.MultiLabelSoftMarginLoss

mindspore.nn.MultiLabelSoftMarginLoss

Consistent

torch.nn.MultiMarginLoss

mindspore.nn.MultiMarginLoss

Consistent

torch.nn.NLLLoss

mindspore.nn.NLLLoss

diff

torch.nn.PReLU

mindspore.nn.PReLU

diff

torch.nn.PixelShuffle

mindspore.nn.PixelShuffle

Consistent

torch.nn.PixelUnshuffle

mindspore.nn.PixelUnshuffle

Consistent

torch.nn.PoissonNLLLoss

mindspore.nn.PoissonNLLLoss

Consistent

torch.nn.ReflectionPad1d

mindspore.nn.ReflectionPad1d

Consistent

torch.nn.ReflectionPad2d

mindspore.nn.ReflectionPad2d

Consistent

torch.nn.ReLU

mindspore.nn.ReLU

diff

torch.nn.ReLU6

mindspore.nn.ReLU6

Consistent

torch.nn.ReplicationPad1d

mindspore.nn.ReplicationPad1d

Consistent

torch.nn.ReplicationPad2d

mindspore.nn.ReplicationPad2d

Consistent

torch.nn.ReplicationPad3d

mindspore.nn.ReplicationPad3d

Consistent

torch.nn.RNN

mindspore.nn.RNN

diff

torch.nn.RNNCell

mindspore.nn.RNNCell

diff

torch.nn.RReLU

mindspore.nn.RReLU

Consistent

torch.nn.SeLU

mindspore.nn.SeLU

Consistent

torch.nn.Sequential

mindspore.nn.SequentialCell

diff

torch.nn.Sigmoid

mindspore.nn.Sigmoid

diff

torch.nn.SiLU

mindspore.nn.SiLU

Consistent

torch.nn.SmoothL1Loss

mindspore.nn.SmoothL1Loss

diff

torch.nn.SoftMarginLoss

mindspore.nn.SoftMarginLoss

Consistent

torch.nn.Softmax

mindspore.nn.Softmax

diff

torch.nn.Softmin

mindspore.nn.Softmin

diff

torch.nn.Softmax2d

mindspore.nn.Softmax2d

Consistent

torch.nn.Softshrink

mindspore.nn.SoftShrink

diff

torch.nn.Softsign

mindspore.nn.Softsign

Consistent

torch.nn.SyncBatchNorm

mindspore.nn.SyncBatchNorm

Difference comparison is under development

torch.nn.Tanh

mindspore.nn.Tanh

diff

torch.nn.Tanhshrink

mindspore.nn.Tanhshrink

Consistent

torch.nn.Threshold

mindspore.nn.Threshold

Consistent

torch.nn.Transformer

mindspore.nn.Transformer

Consistent

torch.nn.TransformerDecoder

mindspore.nn.TransformerDecoder

Consistent

torch.nn.TransformerEncoder

mindspore.nn.TransformerEncoder

Consistent

torch.nn.TransformerDecoderLayer

mindspore.nn.TransformerDecoderLayer

Consistent

torch.nn.TransformerEncoderLayer

mindspore.nn.TransformerEncoderLayer

Consistent

torch.nn.TripletMarginLoss

mindspore.nn.TripletMarginLoss

The functions are consistent, but the number or sequence of parameters is inconsistent.

torch.nn.Unflatten

mindspore.nn.Unflatten

Consistent

torch.nn.Unfold

mindspore.nn.Unfold

diff

torch.nn.Upsample

mindspore.nn.Upsample

diff

torch.nn.ZeroPad2d

mindspore.nn.ZeroPad2d

Consistent

torch.nn.functional

PyTorch 1.8.1 APIs

MindSpore APIs

Descriptions

torch.nn.functional.adaptive_avg_pool1d

mindspore.ops.adaptive_avg_pool1d

diff

torch.nn.functional.adaptive_avg_pool2d

mindspore.ops.adaptive_avg_pool2d

Consistent

torch.nn.functional.adaptive_avg_pool3d

mindspore.ops.adaptive_avg_pool3d

Consistent

torch.nn.functional.adaptive_max_pool1d

mindspore.ops.adaptive_max_pool1d

diff

torch.nn.functional.adaptive_max_pool2d

mindspore.ops.adaptive_max_pool2d

Consistent

torch.nn.functional.affine_grid

mindspore.ops.affine_grid

Consistent

torch.nn.functional.avg_pool1d

mindspore.ops.avg_pool1d

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.avg_pool2d

mindspore.ops.avg_pool2d

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.avg_pool3d

mindspore.ops.avg_pool3d

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.batch_norm

mindspore.ops.batch_norm

Consistent

torch.nn.functional.binary_cross_entropy

mindspore.ops.binary_cross_entropy

diff

torch.nn.functional.binary_cross_entropy_with_logits

mindspore.ops.binary_cross_entropy_with_logits

diff

torch.nn.functional.conv1d

mindspore.ops.conv1d

Consistent

torch.nn.functional.conv2d

mindspore.ops.conv2d

Consistent

torch.nn.functional.conv3d

mindspore.ops.conv3d

Consistent

torch.nn.functional.cosine_embedding_loss

mindspore.ops.cosine_embedding_loss

The functions are consistent

torch.nn.functional.cosine_similarity

mindspore.ops.cosine_similarity

Consistent

torch.nn.functional.cross_entropy

mindspore.ops.cross_entropy

Consistent

torch.nn.functional.ctc_loss

mindspore.ops.ctc_loss

Consistent

torch.nn.functional.dropout

mindspore.ops.dropout

Consistent

torch.nn.functional.dropout2d

mindspore.ops.dropout2d

The functions are consistent, but the parameter data types are inconsistent

torch.nn.functional.dropout3d

mindspore.ops.dropout3d

The functions are consistent, but the parameter data types are inconsistent

torch.nn.functional.elu

mindspore.ops.elu

diff

torch.nn.functional.fold

mindspore.ops.fold

diff

torch.nn.functional.gelu

mindspore.ops.gelu

diff

torch.nn.functional.glu

mindspore.ops.glu

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.grid_sample

mindspore.ops.grid_sample

diff

torch.nn.functional.gumbel_softmax

mindspore.ops.gumbel_softmax

Consistent.

torch.nn.functional.hardshrink

mindspore.ops.hardshrink

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.hardsigmoid

mindspore.ops.hardsigmoid

Consistent.

torch.nn.functional.hardswish

mindspore.ops.hardswish

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.hardtanh

mindspore.ops.hardtanh

Consistent

torch.nn.functional.hinge_embedding_loss

mindspore.ops.hinge_embedding_loss

Consistent

torch.nn.functional.interpolate

mindspore.ops.interpolate

diff

torch.nn.functional.kl_div

mindspore.ops.kl_div

diff

torch.nn.functional.l1_loss

mindspore.ops.l1_loss

Consistent

torch.nn.functional.leaky_relu

mindspore.ops.leaky_relu

diff

torch.nn.functional.logsigmoid

mindspore.ops.logsigmoid

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.log_softmax

mindspore.ops.log_softmax

diff

torch.nn.functional.lp_pool1d

mindspore.ops.lp_pool1d

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.lp_pool2d

mindspore.ops.lp_pool2d

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.margin_ranking_loss

mindspore.ops.margin_ranking_loss

Consistent

torch.nn.functional.max_pool3d

mindspore.ops.max_pool3d

Consistent

torch.nn.functional.max_unpool1d

mindspore.ops.max_unpool1d

Consistent

torch.nn.functional.max_unpool2d

mindspore.ops.max_unpool2d

Consistent

torch.nn.functional.max_unpool3d

mindspore.ops.max_unpool3d

Consistent

torch.nn.functional.mse_loss

mindspore.ops.mse_loss

Consistent

torch.nn.functional.multi_margin_loss

mindspore.ops.multi_margin_loss

Consistent

torch.nn.functional.multilabel_margin_loss

mindspore.ops.multilabel_margin_loss

Consistent

torch.nn.functional.multilabel_soft_margin_loss

mindspore.ops.multilabel_soft_margin_loss

Consistent

torch.nn.functional.nll_loss

mindspore.ops.nll_loss

Consistent

torch.nn.functional.pad

mindspore.ops.pad

diff

torch.nn.functional.pdist

mindspore.ops.pdist

Consistent

torch.nn.functional.pixel_shuffle

mindspore.ops.pixel_shuffle

Consistent

torch.nn.functional.pixel_unshuffle

mindspore.ops.pixel_unshuffle

Consistent

torch.nn.functional.prelu

mindspore.ops.prelu

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.relu

mindspore.ops.relu

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.relu6

mindspore.ops.relu6

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.rrelu

mindspore.ops.rrelu

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.selu

mindspore.ops.selu

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.sigmoid

mindspore.ops.sigmoid

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.silu

mindspore.ops.silu

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.softmax

mindspore.ops.softmax

diff

torch.nn.functional.softmin

mindspore.ops.softmin

diff

torch.nn.functional.softsign

mindspore.ops.softsign

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.smooth_l1_loss

mindspore.ops.smooth_l1_loss

Consistent

torch.nn.functional.soft_margin_loss

mindspore.nn.SoftMarginLoss

diff

torch.nn.functional.softshrink

mindspore.ops.softshrink

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.tanh

mindspore.ops.tanh

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.tanhshrink

mindspore.ops.tanhshrink

Consistent

torch.nn.functional.threshold

mindspore.ops.threshold

The functions are consistent, but the parameter names are inconsistent.

torch.nn.functional.triplet_margin_loss

mindspore.ops.triplet_margin_loss

The functions are consistent, but the number or sequence of parameters is inconsistent.

torch.nn.functional.upsample

mindspore.ops.upsample

diff

torch.nn.Module

PyTorch 1.8.1 APIs

MindSpore APIs

Descriptions

torch.nn.Module.apply

mindspore.nn.Cell.apply

Consistent

torch.nn.utils

PyTorch 1.8.1 APIs

MindSpore APIs

Descriptions

torch.nn.utils.clip_grad_value_

mindspore.ops.clip_by_value

diff

torch.Tensor

PyTorch 1.8.1 APIs

MindSpore APIs

Descriptions

torch.Tensor.abs

mindspore.Tensor.abs

Consistent

torch.Tensor.absolute

mindspore.Tensor.absolute

Consistent

torch.Tensor.acos

mindspore.Tensor.acos

Consistent

torch.Tensor.acosh

mindspore.Tensor.acosh

Consistent

torch.Tensor.add

mindspore.Tensor.add

Consistent

torch.Tensor.addbmm

mindspore.Tensor.addbmm

Consistent

torch.Tensor.addcdiv

mindspore.Tensor.addcdiv

Consistent

torch.Tensor.addcmul

mindspore.Tensor.addcmul

Consistent

torch.Tensor.addmm

mindspore.Tensor.addmm

Consistent

torch.Tensor.addmv

mindspore.Tensor.addmv

The functions are consistent, but the parameter names are inconsistent.

torch.Tensor.addr

mindspore.Tensor.addr

Consistent

torch.Tensor.all

mindspore.Tensor.all

diff

torch.Tensor.amax

mindspore.Tensor.amax

diff

torch.Tensor.amin

mindspore.Tensor.amin

diff

torch.Tensor.any

mindspore.Tensor.any

diff

torch.Tensor.arccos

mindspore.Tensor.arccos

Consistent

torch.Tensor.arccosh

mindspore.Tensor.arccosh

Consistent

torch.Tensor.argmax

mindspore.Tensor.argmax

The functions are consistent, but the parameter names are inconsistent.

torch.Tensor.angle

mindspore.Tensor.angle

Consistent

torch.Tensor.arcsin

mindspore.Tensor.arcsin

Consistent

torch.Tensor.arcsinh

mindspore.Tensor.arcsinh

Consistent

torch.Tensor.arctan

mindspore.Tensor.arctan

Consistent

torch.Tensor.arctanh

mindspore.Tensor.arctanh

Consistent

torch.Tensor.argmin

mindspore.Tensor.argmin

Consistent

torch.Tensor.argsort

mindspore.Tensor.argsort

Consistent

torch.Tensor.asin

mindspore.Tensor.asin

Consistent

torch.Tensor.asinh

mindspore.Tensor.asinh

Consistent

torch.Tensor.atan

mindspore.Tensor.atan

Consistent

torch.Tensor.atan2

mindspore.Tensor.atan2

Consistent

torch.Tensor.atanh

mindspore.Tensor.atanh

Consistent

torch.Tensor.baddbmm

mindspore.Tensor.baddbmm

Consistent

torch.Tensor.bernoulli

mindspore.Tensor.bernoulli

The functions are consistent, but the number or sequence of parameters is inconsistent.

torch.Tensor.bincount

mindspore.Tensor.bincount

Consistent

torch.Tensor.bitwise_and

mindspore.Tensor.bitwise_and

Consistent

torch.Tensor.bitwise_or

mindspore.Tensor.bitwise_or

Consistent

torch.Tensor.bitwise_xor

mindspore.Tensor.bitwise_xor

Consistent

torch.Tensor.bmm

mindspore.Tensor.bmm

The functions are consistent, but the parameter names are inconsistent.

torch.Tensor.bool

mindspore.Tensor.bool

The functions are consistent, but the parameter names are inconsistent.

torch.Tensor.broadcast_to

mindspore.Tensor.broadcast_to

diff

torch.Tensor.ceil

mindspore.Tensor.ceil

Consistent

torch.Tensor.chunk

mindspore.Tensor.chunk

Consistent

torch.Tensor.cholesky

mindspore.Tensor.cholesky

Consistent

torch.Tensor.cholesky_solve

mindspore.Tensor.cholesky_solve

Consistent

torch.Tensor.clamp

mindspore.Tensor.clamp

Consistent

torch.Tensor.clip

mindspore.Tensor.clip

Consistent

torch.Tensor.conj

mindspore.Tensor.conj

Consistent

torch.Tensor.copysign

mindspore.Tensor.copysign

Consistent

torch.Tensor.cos

mindspore.Tensor.cos

Consistent

torch.Tensor.cosh

mindspore.Tensor.cosh

Consistent

torch.Tensor.cross

mindspore.Tensor.cross

Consistent

torch.Tensor.cummax

mindspore.Tensor.cummax

The functions are consistent, but the parameter names are inconsistent.

torch.Tensor.cummin

mindspore.Tensor.cummin

The functions are consistent, but the parameter names are inconsistent.

torch.Tensor.cumprod

mindspore.Tensor.cumprod

Consistent

torch.Tensor.cumsum

mindspore.Tensor.cumsum

Consistent

torch.Tensor.deg2rad

mindspore.Tensor.deg2rad

Consistent

torch.Tensor.diag

mindspore.Tensor.diag

diff

torch.Tensor.diagflat

mindspore.Tensor.diagflat

Consistent

torch.Tensor.diagonal

mindspore.Tensor.diagonal

Consistent

torch.Tensor.diff

mindspore.Tensor.diff

The functions are consistent, but the parameter names are inconsistent.

torch.Tensor.digamma

mindspore.Tensor.digamma

Consistent

torch.Tensor.dim

mindspore.Tensor.ndimension

Consistent

torch.Tensor.div

mindspore.Tensor.div

Consistent

torch.Tensor.divide

mindspore.Tensor.divide

Consistent

torch.Tensor.eq

mindspore.Tensor.equal

Consistent

torch.Tensor.erf

mindspore.Tensor.erf

Consistent

torch.Tensor.erfc

mindspore.Tensor.erfc

Consistent

torch.Tensor.erfinv

mindspore.Tensor.erfinv

Consistent

torch.Tensor.exp

mindspore.Tensor.exp

Consistent

torch.Tensor.expand_as

mindspore.Tensor.expand_as

The functions are consistent, but the parameter names are inconsistent.

torch.Tensor.expm1

mindspore.Tensor.expm1

Consistent

torch.Tensor.flip

mindspore.Tensor.flip

Consistent

torch.Tensor.fliplr

mindspore.Tensor.fliplr

Consistent

torch.Tensor.flipud

mindspore.Tensor.flipud

Consistent

torch.Tensor.float

mindspore.Tensor.float

Consistent

torch.Tensor.float_power

mindspore.Tensor.float_power

diff

torch.Tensor.floor

mindspore.Tensor.floor

Consistent

torch.Tensor.fmod

mindspore.Tensor.fmod

Consistent

torch.Tensor.frac

mindspore.Tensor.frac

The functions are consistent, but the parameter names are inconsistent.

torch.Tensor.gather

mindspore.Tensor.gather_elements

Consistent

torch.Tensor.ge

mindspore.Tensor.ge

The functions are consistent, but the parameter names are inconsistent.

torch.Tensor.geqrf

mindspore.Tensor.geqrf

Consistent

torch.Tensor.ger

mindspore.Tensor.ger

diff

torch.Tensor.greater

mindspore.Tensor.greater

Consistent

torch.Tensor.greater_equal

mindspore.Tensor.greater_equal

Consistent

torch.Tensor.gt

mindspore.Tensor.gt

The functions are consistent, but the parameter names are inconsistent.

torch.Tensor.H

mindspore.Tensor.H

Consistent

torch.Tensor.half

mindspore.Tensor.half

Consistent

torch.Tensor.hardshrink

mindspore.Tensor.hardshrink

Consistent

torch.Tensor.heaviside

mindspore.Tensor.heaviside

Consistent

torch.Tensor.histc

mindspore.Tensor.histc

Consistent

torch.Tensor.hypot

mindspore.Tensor.hypot

Consistent

torch.Tensor.i0

mindspore.Tensor.i0

Consistent

torch.Tensor.igamma

mindspore.Tensor.igamma

Consistent

torch.Tensor.igammac

mindspore.Tensor.igammac

Consistent

torch.Tensor.imag

mindspore.Tensor.imag

Consistent

torch.Tensor.index_add

mindspore.Tensor.index_add

Consistent

torch.Tensor.index_fill

mindspore.Tensor.index_fill

Consistent

torch.Tensor.index_put

mindspore.Tensor.index_put

Consistent

torch.Tensor.index_select

mindspore.Tensor.index_select

The functions are consistent, but the parameter names are inconsistent.

torch.Tensor.inner

mindspore.Tensor.inner

The functions are consistent, but parameter names are different.

torch.Tensor.int

mindspore.Tensor.int

Consistent

torch.Tensor.inverse

mindspore.Tensor.inverse

Consistent

torch.Tensor.isclose

mindspore.Tensor.isclose

The functions are consistent, but parameter names are inconsistent.

torch.Tensor.isfinite

mindspore.Tensor.isfinite

Consistent

torch.Tensor.isinf

mindspore.Tensor.isinf

Consistent

torch.Tensor.isnan

mindspore.Tensor.isnan

Consistent

torch.Tensor.is_complex

mindspore.Tensor.is_complex

Consistent

torch.Tensor.is_floating_point

mindspore.Tensor.is_floating_point

Consistent

torch.Tensor.is_signed

mindspore.Tensor.is_signed

Consistent

torch.Tensor.isneginf

mindspore.Tensor.isneginf

Consistent

torch.Tensor.isposinf

mindspore.Tensor.isposinf

Consistent

torch.Tensor.isreal

mindspore.Tensor.isreal

Consistent

torch.Tensor.item

mindspore.Tensor.item

diff

torch.Tensor.lcm

mindspore.Tensor.lcm

Consistent

torch.Tensor.ldexp

mindspore.Tensor.ldexp

Consistent

torch.Tensor.le

mindspore.Tensor.le

Consistent

torch.Tensor.lerp

mindspore.Tensor.lerp

Consistent

torch.Tensor.less

mindspore.Tensor.less

Consistent

torch.Tensor.less_equal

mindspore.Tensor.less_equal

Consistent

torch.Tensor.log

mindspore.Tensor.log

Consistent

torch.Tensor.log10

mindspore.Tensor.log10

Consistent

torch.Tensor.log1p

mindspore.Tensor.log1p

Consistent

torch.Tensor.log2

mindspore.Tensor.log2

Consistent

torch.Tensor.logaddexp

mindspore.Tensor.logaddexp

Consistent

torch.Tensor.logaddexp2

mindspore.Tensor.logaddexp2

Consistent

torch.Tensor.logdet

mindspore.Tensor.logdet

Consistent

torch.Tensor.logical_and

mindspore.Tensor.logical_and

Consistent

torch.Tensor.logical_not

mindspore.Tensor.logical_not

Consistent

torch.Tensor.logical_or

mindspore.Tensor.logical_or

Consistent

torch.Tensor.logical_xor

mindspore.Tensor.logical_xor

Consistent

torch.Tensor.logit

mindspore.Tensor.logit

The functions are consistent, but the parameter names are inconsistent.

torch.Tensor.logsumexp

mindspore.Tensor.logsumexp

Consistent

torch.Tensor.long

mindspore.Tensor.long

Consistent

torch.Tensor.lt

mindspore.Tensor.lt

Consistent

torch.Tensor.masked_fill

mindspore.Tensor.masked_fill

Consistent

torch.Tensor.masked_scatter

mindspore.Tensor.masked_scatter

diff

torch.Tensor.masked_select

mindspore.Tensor.masked_select

Consistent

torch.Tensor.matmul

mindspore.Tensor.matmul

Consistent

torch.Tensor.max

mindspore.Tensor.max

diff

torch.Tensor.maximum

mindspore.Tensor.maximum

Consistent

torch.Tensor.mean

mindspore.Tensor.mean

The functions are consistent, but parameter names are inconsistent.

torch.Tensor.median

mindspore.Tensor.median

diff

torch.Tensor.mH

mindspore.Tensor.mH

Consistent

torch.Tensor.min

mindspore.Tensor.min

diff

torch.Tensor.minimum

mindspore.Tensor.minimum

The functions are consistent, but parameter names are inconsistent.

torch.Tensor.mm

mindspore.Tensor.mm

Consistent

torch.Tensor.moveaxis

mindspore.Tensor.moveaxis

Consistent

torch.Tensor.movedim

mindspore.Tensor.movedim

Consistent

torch.Tensor.msort

mindspore.Tensor.msort

Consistent

torch.Tensor.mT

mindspore.Tensor.mT

Consistent

torch.Tensor.mul

mindspore.Tensor.mul

Consistent

torch.Tensor.multinomial

mindspore.Tensor.multinomial

The functions are consistent, but the parameter default values are inconsistent.

torch.Tensor.multiply

mindspore.Tensor.multiply

Consistent

torch.Tensor.mvlgamma

mindspore.Tensor.mvlgamma

Consistent

torch.Tensor.nan_to_num

mindspore.Tensor.nan_to_num

Consistent MindSpore only supports float16 and float32 inputs temporarily.

torch.Tensor.nansum

mindspore.Tensor.nansum

Consistent

torch.Tensor.narrow

mindspore.Tensor.narrow

Consistent

torch.Tensor.ndim

mindspore.Tensor.ndim

Consistent

torch.Tensor.ndimension

mindspore.Tensor.ndimension

Consistent

torch.Tensor.ne

mindspore.Tensor.ne

Consistent

torch.Tensor.neg

mindspore.Tensor.neg

Consistent

torch.Tensor.negative

mindspore.Tensor.negative

Consistent

torch.Tensor.nelement

mindspore.Tensor.nelement

Consistent

torch.Tensor.new_ones

mindspore.Tensor.new_ones

Consistent

torch.Tensor.new_zeros

mindspore.Tensor.new_zeros

Consistent

torch.Tensor.nextafter

mindspore.Tensor.nextafter

Consistent

torch.Tensor.norm

mindspore.Tensor.norm

torch.Tensor.norm is about to be deprecated, mindspore.Tensor.norm is completely consistent with torch.linalg.norm

torch.Tensor.nonzero

mindspore.Tensor.nonzero

Consistent

torch.Tensor.not_equal

mindspore.Tensor.not_equal

Consistent

torch.Tensor.numel

mindspore.Tensor.numel

Consistent

torch.Tensor.numpy

mindspore.Tensor.asnumpy

Consistent

torch.Tensor.ormqr

mindspore.Tensor.ormqr

Consistent

torch.Tensor.permute

mindspore.Tensor.permute

Consistent

torch.Tensor.pow

mindspore.Tensor.pow

The functions are consistent, but the parameter names are inconsistent.

torch.Tensor.prod

mindspore.Tensor.prod

diff

torch.Tensor.ravel

mindspore.Tensor.ravel

Consistent

torch.Tensor.real

mindspore.Tensor.real

Consistent

torch.Tensor.reciprocal

mindspore.Tensor.reciprocal

Consistent

torch.Tensor.remainder

mindspore.Tensor.remainder

Consistent

torch.Tensor.renorm

mindspore.Tensor.renorm

The functions are consistent, but the parameter data types are inconsistent.

torch.Tensor.rad2deg

mindspore.Tensor.rad2deg

Consistent

torch.Tensor.repeat

mindspore.Tensor.tile

The functions are consistent, but the parameter names are inconsistent.

torch.Tensor.repeat_interleave

mindspore.Tensor.repeat_interleave

Consistent

torch.Tensor.reshape

mindspore.Tensor.reshape

Consistent

torch.Tensor.reshape_as

mindspore.Tensor.reshape_as

Consistent

torch.Tensor.round

mindspore.Tensor.round

Consistent

torch.Tensor.rot90

mindspore.Tensor.rot90

Consistent

torch.Tensor.rsqrt

mindspore.Tensor.rsqrt

Consistent

torch.Tensor.scatter_

mindspore.ops.tensor_scatter_elements

diff

torch.Tensor.sum_to_size

mindspore.Tensor.sum_to_size

Consistent

torch.Tensor.scatter

mindspore.Tensor.scatter

diff

torch.Tensor.sgn

mindspore.Tensor.sgn

Consistent

torch.Tensor.short

mindspore.Tensor.short

Consistent

torch.Tensor.sigmoid

mindspore.Tensor.sigmoid

Consistent

torch.Tensor.sign

mindspore.Tensor.sign

Consistent

torch.Tensor.signbit

mindspore.Tensor.signbit

Consistent

torch.Tensor.sin

mindspore.Tensor.sin

Consistent

torch.Tensor.sinc

mindspore.Tensor.sinc

Consistent

torch.Tensor.sinh

mindspore.Tensor.sinh

Consistent

torch.Tensor.size

mindspore.Tensor.shape

Consistent

torch.Tensor.slogdet

mindspore.Tensor.slogdet

Consistent

torch.Tensor.sort

mindspore.Tensor.sort

Consistent

torch.Tensor.split

mindspore.Tensor.split

The functions are consistent, but the parameter names are inconsistent. The split_size parameter is split_size_or_sections in MindSpore.

torch.Tensor.sqrt

mindspore.Tensor.sqrt

Consistent

torch.Tensor.square

mindspore.Tensor.square

Consistent

torch.Tensor.squeeze

mindspore.Tensor.squeeze

Consistent

torch.Tensor.std

mindspore.Tensor.std

diff

torch.Tensor.sub

mindspore.Tensor.subtract

Consistent

torch.Tensor.subtract

mindspore.Tensor.subtract

Consistent

torch.Tensor.svd

mindspore.Tensor.svd

diff

torch.Tensor.swapaxes

mindspore.Tensor.swapaxes

Consistent

torch.Tensor.swapdims

mindspore.Tensor.swapdims

Consistent

torch.Tensor.T

mindspore.Tensor.T

Consistent

torch.Tensor.t

mindspore.Tensor.t

Consistent

torch.Tensor.take

mindspore.Tensor.take

Consistent

torch.Tensor.tan

mindspore.Tensor.tan

Consistent

torch.Tensor.tanh

mindspore.Tensor.tanh

Consistent

torch.Tensor.trace

mindspore.Tensor.trace

Consistent

torch.Tensor.transpose

mindspore.Tensor.swapaxes

Consistent

torch.Tensor.tile

mindspore.Tensor.tile

the functions are consistent, but the parameter names are inconsistent.

torch.Tensor.to

mindspore.Tensor.to

the functions are consistent, but the parameter names are inconsistent.

torch.Tensor.topk

mindspore.Tensor.topk

Consistent

torch.Tensor.tril

mindspore.Tensor.tril

The functions are consistent, but the parameter names are inconsistent.

torch.Tensor.tensor_split

mindspore.Tensor.tensor_split

Consistent

torch.Tensor.true_divide

mindspore.Tensor.true_divide

Consistent

torch.Tensor.trunc

mindspore.Tensor.trunc

Consistent

torch.Tensor.unbind

mindspore.Tensor.unbind

Consistent

torch.Tensor.unique_consecutive

mindspore.Tensor.unique_consecutive

Consistent

torch.Tensor.unsqueeze

mindspore.Tensor.unsqueeze

Consistent

torch.Tensor.var

mindspore.Tensor.var

diff

torch.Tensor.view

mindspore.Tensor.view

The functions are consistent

torch.Tensor.view_as

mindspore.Tensor.view_as

Consistent

torch.Tensor.where

mindspore.Tensor.where

Consistent

torch.Tensor.xlogy

mindspore.Tensor.xlogy

The functions are consistent, but the parameter names are inconsistent.

torch.optim

PyTorch 1.8.1 APIs

MindSpore APIs

Descriptions

torch.optim.lr_scheduler.CosineAnnealingLR

mindspore.nn.cosine_decay_lr

diff

torch.optim.lr_scheduler.ExponentialLR

mindspore.nn.exponential_decay_lr

diff

torch.optim.lr_scheduler.MultiStepLR

mindspore.nn.piecewise_constant_lr

diff

torch.optim.lr_scheduler.StepLR

mindspore.nn.piecewise_constant_lr

diff

torch.utils

PyTorch 1.8.1 APIs

MindSpore APIs

Descriptions

torch.utils.data.DataLoader

None

diff

torch.utils.data.Dataset

mindspore.dataset.GeneratorDataset

diff

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

Descriptions

torchtext.data.functional.custom_replace

mindspore.dataset.text.RegexReplace

torchtext.data.functional.load_sp_model

mindspore.dataset.text.SentencePieceVocab

diff

torchtext.data.functional.numericalize_tokens_from_iterator

mindspore.dataset.text.Lookup

diff

torchtext.data.functional.sentencepiece_numericalizer

mindspore.dataset.text.SentencePieceTokenizer

diff

torchtext.data.functional.sentencepiece_tokenizer

mindspore.dataset.text.SentencePieceTokenizer

diff

torchtext.data.functional.simple_space_split

mindspore.dataset.text.WhitespaceTokenizer

torchtext.data.utils.ngrams_iterator

mindspore.dataset.text.Ngram

diff

torchvision

TorchVision 0.10.0 APIs

MindSpore APIs

Descriptions

torchvision.datasets.CelebA

mindspore.dataset.CelebADataset

torchvision.datasets.CIFAR10

mindspore.dataset.Cifar10Dataset

torchvision.datasets.CIFAR100

mindspore.dataset.Cifar100Dataset

torchvision.datasets.CocoDetection

mindspore.dataset.CocoDataset

diff

torchvision.datasets.ImageFolder

mindspore.dataset.ImageFolderDataset

torchvision.datasets.MNIST

mindspore.dataset.MnistDataset

torchvision.datasets.VOCDetection

mindspore.dataset.VOCDataset

diff

torchvision.datasets.VOCSegmentation

mindspore.dataset.VOCDataset

diff

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

diff

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

diff

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

diff

torchvision.transforms.ToTensor

mindspore.dataset.vision.ToTensor

diff

TorchVision 0.14.0 APIs

MindSpore APIs

Descriptions

torchvision.ops.deform_conv2d

mindspore.ops.deformable_conv2d

diff