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. For more information on the differences in framework mechanisms of PyTorch and MindSpore, see: Differences with PyTorch Optimizer, Differences between random generators, and Differences between Initializations.

API Mapping Consistency Criteria and Exceptions

API mapping consistency criteria: consistent API function, consistent number or sequence of parameters, consistent parameter data type, consistent default value, consistent parameter name. Satisfying all the consistency conditions at the same time is considered as consistent API mapping.

The following exceptions are also considered to be consistent the API mapping:

Exception Scenario 1: Compared to the API mapping consistency criteria, only the input data types of API parameters are not supported in the same range, including the following 3 sub-scenarios:

(1) MindSpore API supports passing parameters of int, float, bool, but does not support passing parameters of small bit-width data types such as int8 or float64.

(2) MindSpore API does not support passing parameters of plural type.

(3) MindSpore API does not support passing parameters of 8D and above.

Exception Scenario 2: Compared to MindSpore APIss, the extra parameters of PyTorch API are general difference parameters. General difference parameters exist because PyTorch has some parameters that are added for non-functionality such as performance optimization, and the performance optimization mechanism of MindSpore is different from that of PyTorch.

Exception Scenario 3: If it can be guaranteed that MindSpore API uses the default configuration (or that the user does not configure it), MindSpore API can implement the same functionality as the PyTorch API, and MindSpore API has more parameters than PyTorch API. The functionality is not considered a difference.

Exception Scenario 4: MindSpore sets the default value of the parameters related to the PyTorch overloading mechanism in the API to None, and the corresponding parameters of the PyTorch counterpart API have no default value.

The following is an example of the exception scenario 4. In PyTorch 1.8.1, torch.argmax has two API overloads in the form of torch.argmax(input) and torch.argmax(input, dim, keepdim=False), respectively, where torch.argmax(input) returns the index of the maximum value element in the input Tensor, and torch.argmax(input, dim, keepdim=False) returns the index of the maximum value of the input Tensor on the specified axis.

mindspore.ops.argmax has only one API form, namely mindspore.ops.argmax(input, dim=None, keepdim=False), but mindspore.ops.argmax(input) and torch.argmax(input) have the same function. mindspore.ops.argmax(input, dim, keepdim) and torch.argmax(input, dim, keepdim)have the same function. Compared to torch.argmax, the default value of mindspore.ops.argmax parameter dim is set to None only to adapt the two API overload forms of torch.argmax, so the exception scenario 4 is also considered to be consistent API mapping.

General Difference Parameter Table

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

Parameter Names

Functions

Descriptions

out

Indicates the output Tensor

Assign the operation result to the out parameter, not supported in MindSpore.

layout

Indicates the memory distribution strategy

PyTorch supports torch.striped and torch.split_coo, not supported in MindSpore.

device

Indicates the Tensor storage location

Including device type and optional device number, MindSpore currently supports operator or network-level device scheduling.

requires_grad

Indicates whether to update the gradient

MindSpore can be accessed through the Parameters.requires_grad attribute to control.

generator

Indicates a generator for pseudorandom number

In MindSpore, replaced with the parameter seed of the APIs of random number.

pin_memory

Indicates whether to use locking page memory

Not supported in MindSpore.

memory_format

Indicates the memory format of the Tensor

Not supported in MindSpore.

stable

Indicates whether the sorting is stable

Generally used in the API of Sorting algorithm, not supported in MindSpore.

inplace

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

MindSpore currently provides some inplace APIs, such as assign_add.

sparse_grad

Indicates whether to perform sparsification on the gradient

Not supported in MindSpore.

size_average

The deprecated parameter in PyTorch

The reduction parameter can be used instead.

reduce

The deprecated parameter in PyTorch

The reduction parameter can be used instead.

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

Consistent

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

Consistent

torch.arctan

mindspore.ops.arctan

Consistent

torch.arctanh

mindspore.ops.arctanh

Consistent

torch.argmax

mindspore.ops.argmax

Consistent

torch.argmin

mindspore.ops.argmin

diff

torch.argsort

mindspore.ops.argsort

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

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

Consistent

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

Consistent

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.bucketize

mindspore.ops.bucketize

diff

torch.broadcast_to

mindspore.ops.broadcast_to

diff

torch.cat

mindspore.ops.cat

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

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

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

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

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

torch.cosh

mindspore.ops.cosh

Consistent

torch.count_nonzero

mindspore.ops.count_nonzero

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

torch.cross

mindspore.ops.cross

Consistent

torch.cummax

mindspore.ops.cummax

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

torch.cummin

mindspore.ops.cummin

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

torch.cumprod

mindspore.ops.cumprod

Consistent

torch.cumsum

mindspore.ops.cumsum

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

torch.deg2rad

mindspore.ops.deg2rad

The functions are consistent, but the parameter data types 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

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

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

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

torch.floor_divide

mindspore.ops.floor_divide

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

Consistent

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 data types are inconsistent.

torch.isfinite

mindspore.ops.isfinite

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

torch.isinf

mindspore.ops.isinf

Consistent

torch.isnan

mindspore.ops.isnan

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

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_nonzero

mindspore.ops.is_nonzero

Consistent

torch.is_tensor

mindspore.ops.is_tensor

Consistent

torch.kaiser_window

mindspore.ops.kaiser_window

Consistent

torch.kron

mindspore.ops.kron

Consistent

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

Consistent

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.cond

mindspore.ops.cond

Consistent

torch.linalg.eigvals

mindspore.ops.eigvals

Consistent

torch.linalg.norm

mindspore.ops.norm

Consistent

torch.linspace

mindspore.ops.linspace

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

torch.log

mindspore.ops.log

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

torch.log2

mindspore.ops.log2

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

torch.log10

mindspore.ops.log10

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

torch.logaddexp

mindspore.ops.logaddexp

Consistent

torch.logaddexp2

mindspore.ops.logaddexp2

Consistent

torch.logcumsumexp

mindspore.ops.logcumsumexp

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

torch.log1p

mindspore.ops.log1p

Consistent

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

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

torch.lt

mindspore.ops.lt

Consistent

torch.lu_solve

mindspore.ops.lu_solve

Consistent

torch.lu_unpack

mindspore.ops.lu_unpack

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

Consistent

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

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

torch.nan_to_num

mindspore.ops.nan_to_num

Consistent

torch.nansum

mindspore.ops.nansum

Consistent

torch.narrow

mindspore.ops.narrow

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

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

Consistent

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

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

torch.outer

mindspore.ops.outer

Consistent

torch.poisson

mindspore.ops.random_poisson

diff

torch.polar

mindspore.ops.polar

Consistent

torch.polygamma

mindspore.ops.polygamma

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

torch.pow

mindspore.ops.pow

Consistent

torch.prod

mindspore.ops.prod

diff

torch.rad2deg

mindspore.ops.rad2deg

The functions are consistent, but the parameter data types 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

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

torch.randint_like

mindspore.ops.randint_like

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

torch.randperm

mindspore.ops.randperm

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

torch.range

mindspore.ops.range

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

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.roll

mindspore.ops.roll

Consistent

torch.rot90

mindspore.ops.rot90

Consistent

torch.round

mindspore.ops.round

Consistent

torch.row_stack

mindspore.ops.row_stack

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

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

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

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

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

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

torch.unsqueeze

mindspore.ops.unsqueeze

Consistent

torch.vander

mindspore.ops.vander

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.BCELoss

mindspore.nn.BCELoss

Consistent

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

Consistent

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.Flatten

mindspore.nn.Flatten

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

Consistent

torch.nn.Hardswish

mindspore.nn.Hswish

Consistent

torch.nn.Hardtanh

mindspore.nn.Hardtanh

Consistent

torch.nn.HingeEmbeddingLoss

mindspore.nn.HingeEmbeddingLoss

Consistent

torch.nn.HuberLoss

mindspore.nn.HuberLoss

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.KLDivLoss

mindspore.nn.KLDivLoss

Consistent

torch.nn.L1Loss

mindspore.nn.L1Loss

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.nn.LRN

diff

torch.nn.LogSigmoid

mindspore.nn.LogSigmoid

Consistent

torch.nn.LogSoftMax

mindspore.nn.LogSoftMax

Consistent

torch.nn.MSELoss

mindspore.nn.MSELoss

Consistent

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.ModuleList

mindspore.nn.CellList

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

torch.nn.MultiheadAttention

mindspore.nn.MultiheadAttention

Consistent

torch.nn.MultiLabelMarginLoss

mindspore.nn.MultiLabelMarginLoss

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

diff

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

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

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

diff

torch.nn.functional.avg_pool2d

mindspore.ops.avg_pool2d

diff

torch.nn.functional.avg_pool3d

mindspore.ops.avg_pool3d

diff

torch.nn.functional.batch_norm

mindspore.ops.batch_norm

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

torch.nn.functional.bilinear

mindspore.ops.bidense

Consistent

torch.nn.functional.binary_cross_entropy

mindspore.ops.binary_cross_entropy

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

torch.nn.functional.binary_cross_entropy_with_logits

mindspore.ops.binary_cross_entropy_with_logits

diff

torch.nn.functional.celu

mindspore.ops.celu

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

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.linear

mindspore.ops.dense

Consistent

torch.nn.functional.dropout

mindspore.ops.dropout

diff

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

Consistent

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

Consistent

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.ops.soft_margin_loss

Consistent

torch.nn.functional.softshrink

mindspore.ops.softshrink

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

torch.nn.functional.tanh

mindspore.ops.tanh

Consistent

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.unfold

mindspore.ops.unfold

Consistent

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

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

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.cauchy_

mindspore.Tensor.cauchy

Consistent

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.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

mindspore.Tensor.broadcast_to

diff

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.fill_diagonal_

mindspore.Tensor.fill_diagonal

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.floor_divide

mindspore.Tensor.floor_divide

Consistent

torch.Tensor.fmax

mindspore.Tensor.fmax

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.log_normal

mindspore.Tensor.log_normal

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.logcumsumexp

mindspore.Tensor.logcumsumexp

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

Consistent

torch.Tensor.logsumexp

mindspore.Tensor.logsumexp

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

torch.Tensor.long

mindspore.Tensor.long

Consistent

torch.Tensor.lt

mindspore.Tensor.lt

Consistent

torch.Tensor.lu_solve

mindspore.Tensor.lu_solve

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

Consistent

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

torch.Tensor.nansum

mindspore.Tensor.nansum

Consistent

torch.Tensor.narrow

mindspore.Tensor.narrow

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

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.orgqr

mindspore.Tensor.orgqr

Consistent

torch.Tensor.ormqr

mindspore.Tensor.ormqr

Consistent

torch.Tensor.outer

mindspore.Tensor.outer

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.roll

mindspore.Tensor.roll

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.sum

mindspore.Tensor.sum

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

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

diff

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

diff

torch.Tensor.topk

mindspore.Tensor.topk

Consistent

torch.Tensor.triu

mindspore.Tensor.triu

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

torch.Tensor.tril

mindspore.Tensor.tril

Consistent

torch.Tensor.tensor_split

mindspore.Tensor.tensor_split

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

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

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

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.Adadelta

mindspore.nn.Adadelta

Consistent

torch.optim.Adagrad

mindspore.nn.Adagrad

diff

torch.optim.Adam

mindspore.nn.Adam

diff

torch.optim.AdaMax

mindspore.nn.AdaMax

diff

torch.optim.AdamW

mindspore.nn.AdamWeightDecay

diff

torch.optim.ASGD

mindspore.nn.ASGD

Consistent

torch.optim.Optimizer

mindspore.nn.Optimizer

diff

torch.optim.SparseAdam

mindspore.nn.LazyAdam

diff

torch.optim.RMSProp

mindspore.nn.RMSProp

diff

torch.optim.Rprop

mindspore.nn.Rprop

diff

torch.optim.SGD

mindspore.nn.SGD

Consistent

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.optim

PyTorch 1.8.1 APIs

MindSpore APIs

Descriptions

torch.optim.Adam

mindspore.nn.optim_ex.Adam

Consistent

torch.optim.AdamW

mindspore.nn.optim_ex.AdamW

Consistent

torch.optim.SGD

mindspore.nn.optim_ex.SGD

Consistent

torch.utils

PyTorch 1.8.1 APIs

MindSpore APIs

Descriptions

torch.utils.data.DataLoader

mindspore.dataset.GeneratorDataset

diff

torch.utils.data.distributed.DistributedSampler

mindspore.dataset.DistributedSampler

diff

torch.utils.data.RandomSampler

mindspore.dataset.RandomSampler

diff

torch.utils.data.SequentialSampler

mindspore.dataset.SequentialSampler

diff

torch.utils.data.SubsetRandomSampler

mindspore.dataset.SubsetRandomSampler

diff

torch.utils.data.WeightedRandomSampler

mindspore.dataset.WeightedRandomSampler

diff

torchaudio

TorchAudio 0.8.1 APIs

MindSpore APIs

Descriptions

torchaudio.datasets.CMUARCTIC

mindspore.dataset.CMUArcticDataset

diff

torchaudio.datasets.GTZAN

mindspore.dataset.GTZANDataset

diff

torchaudio.datasets.LIBRITTS

mindspore.dataset.LibriTTSDataset

diff

torchaudio.datasets.LJSPEECH

mindspore.dataset.LJSpeechDataset

diff

torchaudio.datasets.SPEECHCOMMANDS

mindspore.dataset.SpeechCommandsDataset

diff

torchaudio.datasets.TEDLIUM

mindspore.dataset.TedliumDataset

diff

torchaudio.datasets.YESNO

mindspore.dataset.YesNoDataset

diff

torchaudio.transforms.AmplitudeToDB

mindspore.dataset.audio.AmplitudeToDB

diff

torchaudio.transforms.ComplexNorm

mindspore.dataset.audio.ComplexNorm

Consistent

torchaudio.transforms.ComputeDeltas

mindspore.dataset.audio.ComputeDeltas

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

torchaudio.transforms.Fade

mindspore.dataset.audio.Fade

Consistent

torchaudio.transforms.FrequencyMasking

mindspore.dataset.audio.FrequencyMasking

diff

torchaudio.transforms.GriffinLim

mindspore.dataset.audio.GriffinLim

diff

torchaudio.transforms.InverseMelScale

mindspore.dataset.audio.InverseMelScale

diff

torchaudio.transforms.MelScale

mindspore.dataset.audio.MelScale

diff

torchaudio.transforms.MelSpectrogram

mindspore.dataset.audio.MelSpectrogram

diff

torchaudio.transforms.MFCC

mindspore.dataset.audio.MFCC

Consistent

torchaudio.transforms.MuLawEncoding

mindspore.dataset.audio.MuLawEncoding

Consistent

torchaudio.transforms.MuLawDecoding

mindspore.dataset.audio.MuLawDecoding

Consistent

torchaudio.transforms.Resample

mindspore.dataset.audio.Resample

diff

torchaudio.transforms.SlidingWindowCmn

mindspore.dataset.audio.SlidingWindowCmn

Consistent

torchaudio.transforms.SpectralCentroid

mindspore.dataset.audio.SpectralCentroid

diff

torchaudio.transforms.Spectrogram

mindspore.dataset.audio.Spectrogram

diff

torchaudio.transforms.TimeMasking

mindspore.dataset.audio.TimeMasking

diff

torchaudio.transforms.TimeStretch

mindspore.dataset.audio.TimeStretch

Consistent

torchaudio.transforms.Vad

mindspore.dataset.audio.Vad

Consistent

torchaudio.transforms.Vol

mindspore.dataset.audio.Vol

Consistent

torchtext

TorchText 0.9.1 APIs

MindSpore APIs

Descriptions

torchtext.data.functional.custom_replace

mindspore.dataset.text.RegexReplace

diff

torchtext.data.functional.load_sp_model

mindspore.dataset.text.SentencePieceTokenizer

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

diff

torchtext.data.utils.ngrams_iterator

mindspore.dataset.text.Ngram

diff

torchtext.datasets.AG_NEWS

mindspore.dataset.AGNewsDataset

diff

torchtext.datasets.AmazonReviewFull

mindspore.dataset.AmazonReviewDataset

diff

torchtext.datasets.AmazonReviewPolarity

mindspore.dataset.AmazonReviewDataset

diff

torchtext.datasets.CoNLL2000Chunking

mindspore.dataset.CoNLL2000Dataset

diff

torchtext.datasets.DBpedia

mindspore.dataset.DBpediaDataset

diff

torchtext.datasets.IMDB

mindspore.dataset.IMDBDataset

diff

torchtext.datasets.IWSLT2016

mindspore.dataset.IWSLT2016Dataset

diff

torchtext.datasets.IWSLT2017

mindspore.dataset.IWSLT2017Dataset

diff

torchtext.datasets.PennTreebank

mindspore.dataset.PennTreebankDataset

diff

torchtext.datasets.SogouNews

mindspore.dataset.SogouNewsDataset

diff

torchtext.datasets.SQuAD1

mindspore.dataset.SQuADDataset

diff

torchtext.datasets.SQuAD2

mindspore.dataset.SQuADDataset

diff

torchtext.datasets.UDPOS

mindspore.dataset.UDPOSDataset

diff

torchtext.datasets.WikiText103

mindspore.dataset.WikiTextDataset

diff

torchtext.datasets.WikiText2

mindspore.dataset.WikiTextDataset

diff

torchtext.datasets.YahooAnswers

mindspore.dataset.YahooAnswersDataset

diff

torchtext.datasets.YelpReviewFull

mindspore.dataset.YelpReviewDataset

diff

torchtext.datasets.YelpReviewPolarity

mindspore.dataset.YelpReviewDataset

diff

torchvision

TorchVision 0.9.1 APIs

MindSpore APIs

Descriptions

torchvision.datasets.CelebA

mindspore.dataset.CelebADataset

diff

torchvision.datasets.Cityscapes

mindspore.dataset.CityscapesDataset

diff

torchvision.datasets.CIFAR10

mindspore.dataset.Cifar10Dataset

diff

torchvision.datasets.CIFAR100

mindspore.dataset.Cifar100Dataset

diff

torchvision.datasets.CocoDetection

mindspore.dataset.CocoDataset

diff

torchvision.datasets.ImageFolder

mindspore.dataset.ImageFolderDataset

diff

torchvision.datasets.MNIST

mindspore.dataset.MnistDataset

diff

torchvision.datasets.VOCDetection

mindspore.dataset.VOCDataset

diff

torchvision.datasets.VOCSegmentation

mindspore.dataset.VOCDataset

diff

torchvision.ops.nms

mindspore.ops.NMSWithMask

diff

torchvision.ops.roi_align

mindspore.ops.ROIAlign

diff

torchvision.transforms.CenterCrop

mindspore.dataset.vision.CenterCrop

Consistent

torchvision.transforms.ColorJitter

mindspore.dataset.vision.RandomColorAdjust

Consistent

torchvision.transforms.Compose

mindspore.dataset.transforms.Compose

Consistent

torchvision.transforms.ConvertImageDtype

mindspore.dataset.transforms.TypeCast

diff

torchvision.transforms.FiveCrop

mindspore.dataset.vision.FiveCrop

Consistent

torchvision.transforms.GaussianBlur

mindspore.dataset.vision.GaussianBlur

Consistent

torchvision.transforms.Grayscale

mindspore.dataset.vision.Grayscale

Consistent

torchvision.transforms.LinearTransformation

mindspore.dataset.vision.LinearTransformation

Consistent

torchvision.transforms.Normalize

mindspore.dataset.vision.Normalize

diff

torchvision.transforms.Pad

mindspore.dataset.vision.Pad

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

torchvision.transforms.RandomAffine

mindspore.dataset.vision.RandomAffine

diff

torchvision.transforms.RandomApply

mindspore.dataset.transforms.RandomApply

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

torchvision.transforms.RandomChoice

mindspore.dataset.transforms.RandomChoice

Consistent

torchvision.transforms.RandomCrop

mindspore.dataset.vision.RandomCrop

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

torchvision.transforms.RandomGrayscale

mindspore.dataset.vision.RandomGrayscale

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

torchvision.transforms.RandomHorizontalFlip

mindspore.dataset.vision.RandomHorizontalFlip

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

torchvision.transforms.RandomOrder

mindspore.dataset.transforms.RandomOrder

Consistent

torchvision.transforms.RandomPerspective

mindspore.dataset.vision.RandomPerspective

diff

torchvision.transforms.RandomResizedCrop

mindspore.dataset.vision.RandomResizedCrop

diff

torchvision.transforms.RandomRotation

mindspore.dataset.vision.RandomRotation

diff

torchvision.transforms.RandomVerticalFlip

mindspore.dataset.vision.RandomVerticalFlip

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

torchvision.transforms.Resize

mindspore.dataset.vision.Resize

Consistent

torchvision.transforms.TenCrop

mindspore.dataset.vision.TenCrop

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

torchvision.transforms.ToPILImage

mindspore.dataset.vision.ToPIL

diff

torchvision.transforms.ToTensor

mindspore.dataset.vision.ToTensor

diff

torchvision.ops.deform_conv2d

mindspore.ops.deformable_conv2d

diff