PyTorch与MindSpore API映射表

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

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

PyTorch 1.8.1

torch

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.abs

mindspore.ops.abs

差异对比

torch.acos

mindspore.ops.acos

差异对比

torch.add

mindspore.ops.add

差异对比

torch.addbmm

mindspore.ops.addbmm

功能一致,参数名不一致

torch.addmm

mindspore.ops.addmm

功能一致,参数名不一致

torch.angle

mindspore.ops.angle

功能一致

torch.arccosh

mindspore.ops.arccosh

功能一致,参数名不一致

torch.arcsin

mindspore.ops.arcsin

功能一致,参数名不一致

torch.arctan

mindspore.ops.arctan

功能一致,参数名不一致

torch.asin

mindspore.ops.asin

差异对比

torch.atan

mindspore.ops.atan

差异对比

torch.atan2

mindspore.ops.atan2

差异对比

torch.baddbmm

mindspore.ops.baddbmm

功能一致,参数名不一致

torch.bartlett_window

mindspore.ops.bartlett_window

差异对比

torch.bitwise_and

mindspore.ops.bitwise_and

差异对比

torch.bitwise_or

mindspore.ops.bitwise_or

差异对比

torch.bitwise_xor

mindspore.ops.bitwise_xor

差异对比

torch.blackman_window

mindspore.ops.blackman_window

差异对比

torch.bmm

mindspore.ops.BatchMatMul

差异对比

torch.broadcast_to

mindspore.ops.broadcast_to

差异对比

torch.ceil

mindspore.ops.ceil

差异对比

torch.conj

mindspore.ops.conj

差异对比

torch.cos

mindspore.ops.cos

差异对比

torch.cosh

mindspore.ops.cosh

差异对比

torch.cross

mindspore.numpy.cross

差异对比

torch.cumprod

mindspore.ops.cumprod

差异对比

torch.cumsum

mindspore.ops.cumsum

差异对比

torch.div

mindspore.ops.div

差异对比

torch.divide

mindspore.ops.divide

功能一致

torch.empty

mindspore.numpy.empty

差异对比

torch.empty_like

mindspore.numpy.empty_like

差异对比

torch.eq

mindspore.ops.equal

差异对比

torch.erfc

mindspore.ops.erfc

差异对比

torch.erfinv

mindspore.ops.erfinv

差异对比

torch.exp

mindspore.ops.exp

差异对比

torch.expm1

mindspore.ops.expm1

差异对比

torch.eye

mindspore.ops.eye

差异对比

torch.flip

mindspore.ops.flip

功能一致,参数名不一致

torch.fliplr

mindspore.ops.fliplr

功能一致,参数名不一致

torch.flipud

mindspore.ops.flipud

功能一致,参数名不一致

torch.full

mindspore.numpy.full

差异对比

torch.full_like

mindspore.numpy.full_like

差异对比

torch.hann_window

mindspore.numpy.hanning

差异对比

torch.is_floating_point

mindspore.ops.is_floating_point

功能一致,参数名不一致

torch.negative

mindspore.ops.negative

功能一致,参数名不一致

torch.numel

mindspore.ops.numel

功能一致,参数名不一致

torch.roll

mindspore.ops.roll

功能一致,参数名不一致

torch.unsqueeze

mindspore.ops.expand_dims

差异对比

torch.distributed

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.distributed.all_gather

mindspore.ops.AllGather

差异对比

torch.distributed.all_reduce

mindspore.ops.AllReduce

差异对比

torch.distributed.get_rank

mindspore.communication.get_rank

差异对比

torch.distributed.init_process_group

mindspore.communication.init

差异对比

torch.distributed.new_group

mindspore.communication.create_group

差异对比

torch.nn

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.nn.AdaptiveAvgPool2d

mindspore.nn.AdaptiveAvgPool2d

差异对比

torch.nn.AvgPool1d

mindspore.nn.AvgPool1d

差异对比

torch.nn.AvgPool2d

mindspore.nn.AvgPool2d

差异对比

torch.nn.AvgPool3d

mindspore.nn.AvgPool3d

功能一致

torch.nn.BCEWithLogitsLoss

mindspore.nn.BCEWithLogitsLoss

差异对比

torch.nn.BatchNorm1d

mindspore.nn.BatchNorm1d

差异对比

torch.nn.BatchNorm2d

mindspore.nn.BatchNorm2d

差异对比

torch.nn.CTCLoss

mindspore.nn.CTCLoss

功能一致

torch.nn.Conv1d

mindspore.nn.Conv1d

差异对比

torch.nn.Conv2d

mindspore.nn.Conv2d

差异对比

torch.nn.Conv3d

mindspore.nn.Conv3d

差异对比

torch.nn.ConvTranspose1d

mindspore.nn.Conv1dTranspose

差异对比

torch.nn.ConvTranspose2d

mindspore.nn.Conv2dTranspose

差异对比

torch.nn.ConvTranspose3d

mindspore.nn.Conv3dTranspose

差异对比

torch.nn.CosineEmbeddingLoss

mindspore.nn.CosineEmbeddingLoss

差异对比

torch.nn.CrossEntropyLoss

mindspore.nn.CrossEntropyLoss

差异对比

torch.nn.Dropout

mindspore.nn.Dropout

差异对比

torch.nn.Dropout

mindspore.ops.dropout

差异对比

torch.nn.FractionalMaxPool2d

mindspore.nn.FractionalMaxPool2d

功能一致

torch.nn.GELU

mindspore.nn.GELU

差异对比

torch.nn.GRU

mindspore.nn.GRU

差异对比

torch.nn.GroupNorm

mindspore.nn.GroupNorm

差异对比

torch.nn.Hardshrink

mindspore.nn.HShrink

差异对比

torch.nn.L1Loss

mindspore.nn.L1Loss

差异对比

torch.nn.LPPool1d

mindspore.nn.LPPool1d

功能一致

torch.nn.LPPool2d

mindspore.nn.LPPool2d

功能一致

torch.nn.LSTM

mindspore.nn.LSTM

差异对比

torch.nn.LSTMCell

mindspore.nn.LSTMCell

差异对比

torch.nn.LayerNorm

mindspore.nn.LayerNorm

差异对比

torch.nn.LeakyReLU

mindspore.nn.LeakyReLU

差异对比

torch.nn.Linear

mindspore.nn.Dense

差异对比

torch.nn.MSELoss

mindspore.nn.MSELoss

差异对比

torch.nn.MarginRankingLoss

mindspore.nn.MarginRankingLoss

功能一致,PyTorch存在弃用参数 size_averagereduce

torch.nn.MaxPool1d

mindspore.nn.MaxPool1d

差异对比

torch.nn.MaxPool2d

mindspore.nn.MaxPool2d

差异对比

torch.nn.MaxPool3d

mindspore.nn.MaxPool3d

功能一致

torch.nn.PReLU

mindspore.nn.PReLU

差异对比

torch.nn.PixelShuffle

mindspore.nn.PixelShuffle

功能一致

torch.nn.PixelUnshuffle

mindspore.nn.PixelUnshuffle

功能一致

torch.nn.ReLU

mindspore.nn.ReLU

差异对比

torch.nn.Sigmoid

mindspore.nn.Sigmoid

差异对比

torch.nn.SmoothL1Loss

mindspore.nn.SmoothL1Loss

差异对比

torch.nn.Softmax

mindspore.nn.Softmax

差异对比

torch.nn.Softshrink

mindspore.nn.SoftShrink

差异对比

torch.nn.Tanh

mindspore.nn.Tanh

差异对比

torch.nn.Unfold

mindspore.nn.Unfold

差异对比

torch.nn.functional

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.nn.functional.binary_cross_entropy

mindspore.nn.BCELoss

差异对比

torch.nn.functional.elu

mindspore.ops.elu

差异对比

torch.nn.functional.l1_loss

mindspore.nn.L1Loss

差异对比

torch.nn.functional.lp_pool1d

mindspore.ops.lp_pool1d

功能一致,参数名不一致

torch.nn.functional.lp_pool2d

mindspore.ops.lp_pool2d

功能一致,参数名不一致

torch.nn.functional.margin_ranking_loss

mindspore.ops.margin_ranking_loss

功能一致,PyTorch存在弃用参数 size_averagereduce

torch.nn.functional.mse_loss

mindspore.nn.MSELoss

差异对比

torch.nn.functional.pad

mindspore.ops.pad

差异对比

torch.nn.functional.pixel_shuffle

mindspore.ops.pixel_shuffle

功能一致,参数名不一致

torch.nn.functional.pixel_unshuffle

mindspore.ops.pixel_unshuffle

功能一致,参数名不一致

torch.nn.functional.soft_margin_loss

mindspore.nn.SoftMarginLoss

差异对比

torch.Tensor

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.Tensor.addbmm

mindspore.Tensor.addbmm

功能一致

torch.Tensor.addmm

mindspore.Tensor.addmm

功能一致

torch.Tensor.arccosh

mindspore.Tensor.arccosh

功能一致

torch.Tensor.angle

mindspore.Tensor.angle

功能一致

torch.Tensor.arcsin

mindspore.Tensor.arcsin

功能一致

torch.Tensor.arcsinh

mindspore.Tensor.arcsinh

功能一致

torch.Tensor.arctan

mindspore.Tensor.arctan

功能一致

torch.Tensor.arctanh

mindspore.Tensor.arctanh

功能一致

torch.Tensor.copysign

mindspore.Tensor.copysign

功能一致

torch.Tensor.deg2rad

mindspore.Tensor.deg2rad

功能一致

torch.Tensor.divide

mindspore.Tensor.divide

功能一致

torch.Tensor.flip

mindspore.Tensor.flip

功能一致

torch.Tensor.fliplr

mindspore.Tensor.fliplr

功能一致

torch.Tensor.flipud

mindspore.Tensor.flipud

功能一致

torch.Tensor.is_floating_point

mindspore.Tensor.is_floating_point

功能一致

torch.Tensor.is_signed

mindspore.Tensor.is_signed

功能一致

torch.Tensor.lcm

mindspore.Tensor.lcm

功能一致

torch.Tensor.ldexp

mindspore.Tensor.ldexp

功能一致

torch.Tensor.logaddexp

mindspore.Tensor.logaddexp

功能一致

torch.Tensor.logaddexp2

mindspore.Tensor.logaddexp2

功能一致

torch.Tensor.logsumexp

mindspore.Tensor.logsumexp

功能一致

torch.Tensor.negative

mindspore.Tensor.negative

功能一致

torch.Tensor.nelement

mindspore.Tensor.nelement

功能一致

torch.Tensor.numel

mindspore.Tensor.numel

功能一致

torch.Tensor.permute

mindspore.Tensor.permute

功能一致

torch.Tensor.remainder

mindspore.Tensor.remainder

功能一致

torch.Tensor.rad2deg

mindspore.Tensor.rad2deg

功能一致

torch.Tensor.repeat_interleave

mindspore.Tensor.repeat_interleave

功能一致

torch.Tensor.reshape_as

mindspore.Tensor.reshape_as

功能一致

torch.Tensor.roll

mindspore.Tensor.roll

功能一致

torch.Tensor.rot90

mindspore.Tensor.rot90

功能一致

torch.Tensor.short

mindspore.Tensor.short

功能一致,MindSpore未定义代表内存格式的 memory_format 参数

torch.optim

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.optim.lr_scheduler.CosineAnnealingLR

mindspore.nn.cosine_decay_lr

差异对比

torch.optim.lr_scheduler.ExponentialLR

mindspore.nn.exponential_decay_lr

差异对比

torch.optim.lr_scheduler.MultiStepLR

mindspore.nn.piecewise_constant_lr

差异对比

torch.optim.lr_scheduler.StepLR

mindspore.nn.piecewise_constant_lr

差异对比

torch.utils

PyTorch 1.8.1 APIs

MindSpore APIs

说明

torch.utils.data.DataLoader

None

差异对比

torch.utils.data.Dataset

mindspore.dataset.GeneratorDataset

差异对比

torch.utils.data.distributed.DistributedSampler

mindspore.dataset.DistributedSampler

torch.utils.data.RandomSampler

mindspore.dataset.RandomSampler

torch.utils.data.SequentialSampler

mindspore.dataset.SequentialSampler

torch.utils.data.SubsetRandomSampler

mindspore.dataset.SubsetRandomSampler

torch.utils.data.WeightedRandomSampler

mindspore.dataset.WeightedRandomSampler

PyTorch 1.5.0

torch

PyTorch 1.5.0 APIs

MindSpore APIs

说明

torch.arange

mindspore.numpy.arange

torch.argmax

mindspore.ops.argmax

差异对比

torch.argmin

mindspore.ops.argmin

差异对比

torch.argsort

mindspore.ops.Sort

差异对比

torch.bincount

mindspore.numpy.bincount

torch.broadcast_tensors

mindspore.ops.BroadcastTo

差异对比

torch.chunk

mindspore.ops.Split

torch.diagflat

mindspore.numpy.diagflat

torch.diagonal

mindspore.numpy.diagonal

torch.dot

mindspore.ops.tensor_dot

差异对比

torch.flatten

mindspore.ops.Flatten

差异对比

torch.flip

mindspore.ops.ReverseV2

torch.floor

mindspore.ops.Floor

torch.floor_divide

mindspore.ops.FloorDiv

差异对比

torch.fmod

mindspore.ops.Mod

torch.from_numpy

mindspore.Tensor.from_numpy

torch.gather

mindspore.ops.GatherD

torch.ge

mindspore.ops.GreaterEqual

torch.gt

mindspore.ops.Greater

torch.hamming_window

mindspore.numpy.hamming

torch.histc

mindspore.ops.HistogramFixedWidth

torch.imag

mindspore.ops.Imag

torch.isfinite

mindspore.ops.IsFinite

torch.isinf

mindspore.ops.IsInf

torch.isnan

mindspore.ops.IsNan

torch.le

mindspore.ops.LessEqual

torch.lerp

mindspore.ops.Lerp

torch.linspace

mindspore.ops.LinSpace

torch.load

mindspore.load_checkpoint

torch.log

mindspore.ops.Log

torch.log1p

mindspore.ops.Log1p

torch.log2

mindspore.numpy.log2

torch.logical_and

mindspore.ops.LogicalAnd

差异对比

torch.logical_not

mindspore.numpy.logical_not

差异对比

torch.logical_or

mindspore.ops.LogicalOr

差异对比

torch.logical_xor

mindspore.numpy.logical_xor

差异对比

torch.logspace

mindspore.numpy.logspace

torch.lt

mindspore.ops.Less

torch.matmul

mindspore.ops.MatMul

torch.matrix_power

mindspore.numpy.matrix_power

torch.matrix_rank

mindspore.ops.Rank

torch.max

mindspore.ops.ArgMaxWithValue

差异对比

torch.mean

mindspore.ops.ReduceMean

torch.meshgrid

mindspore.ops.Meshgrid

torch.min

mindspore.ops.ArgMinWithValue

差异对比

torch.mm

mindspore.ops.MatMul

torch.mul

mindspore.ops.Mul

torch.multinomial

mindspore.ops.multinomial

torch.ne

mindspore.ops.NotEqual

torch.neg

mindspore.ops.Neg

torch.norm

mindspore.ops.LpNorm

差异对比

torch.numel

mindspore.ops.Size

torch.ones

mindspore.ops.Ones

torch.ones_like

mindspore.ops.OnesLike

torch.pow

mindspore.ops.Pow

torch.prod

mindspore.ops.ReduceProd

torch.promote_types

mindspore.numpy.promote_types

torch.rand

mindspore.ops.UniformReal

torch.rand_like

mindspore.ops.UniformReal

torch.randint

mindspore.ops.UniformInt

torch.randint_like

mindspore.ops.UniformInt

torch.randn

mindspore.ops.StandardNormal

torch.randperm

mindspore.ops.Randperm

差异对比

torch.real

mindspore.ops.Real

torch.reciprocal

mindspore.ops.Reciprocal

torch.remainder

mindspore.numpy.remainder

torch.reshape

mindspore.ops.Reshape

torch.result_type

mindspore.numpy.result_type

torch.rot90

mindspore.numpy.rot90

torch.round

mindspore.ops.Rint

torch.rsqrt

mindspore.ops.Rsqrt

torch.save

mindspore.save_checkpoint

torch.sigmoid

mindspore.ops.Sigmoid

torch.sin

mindspore.ops.Sin

torch.sinh

mindspore.ops.Sinh

torch.sort

mindspore.ops.Sort

torch.sparse_coo_tensor

mindspore.SparseTensor

差异对比

torch.split

mindspore.ops.Split

torch.sqrt

mindspore.ops.Sqrt

torch.square

mindspore.ops.Square

torch.squeeze

mindspore.ops.Squeeze

torch.stack

mindspore.ops.Stack

torch.std

mindspore.Tensor.std

torch.std_mean

mindspore.ops.ReduceMean

差异对比

torch.sum

mindspore.ops.ReduceSum

torch.take

mindspore.Tensor.take

差异对比

torch.tan

mindspore.ops.Tan

torch.tanh

mindspore.ops.Tanh

torch.tensor

mindspore.Tensor

torch.Tensor

mindspore.Tensor

torch.tensordot

mindspore.numpy.tensordot

torch.topk

mindspore.ops.TopK

差异对比

torch.trace

mindspore.Tensor.trace

torch.transpose

mindspore.Tensor.transpose

差异对比

torch.trapz

mindspore.numpy.trapz

torch.tril_indices

mindspore.numpy.tril_indices

torch.triu_indices

mindspore.numpy.triu_indices

torch.true_divide

mindspore.numpy.true_divide

torch.trunc

mindspore.numpy.trunc

torch.unbind

mindspore.ops.Unstack

torch.unique

mindspore.ops.Unique

差异对比

torch.var

mindspore.Tensor.var

torch.where

mindspore.numpy.where

torch.zeros

mindspore.ops.Zeros

torch.zeros_like

mindspore.ops.ZerosLike

torch.autograd

PyTorch 1.5.0 APIs

MindSpore APIs

说明

torch.autograd.backward

mindspore.grad

差异对比

torch.autograd.enable_grad

mindspore.ops.stop_gradient

差异对比

torch.autograd.grad

mindspore.grad

差异对比

torch.autograd.no_grad

mindspore.ops.stop_gradient

差异对比

torch.autograd.variable

mindspore.Parameter

torch.cuda

PyTorch 1.5.0 APIs

MindSpore APIs

说明

torch.cuda.device_count

mindspore.communication.get_group_size

torch.cuda.set_device

mindspore.set_context

差异对比

torch.distributions

PyTorch 1.5.0 APIs

MindSpore APIs

说明

torch.distributions.gamma.Gamma

mindspore.ops.Gamma

torch.nn

PyTorch 1.5.0 APIs

MindSpore APIs

说明

torch.nn.Embedding

mindspore.nn.Embedding

差异对比

torch.nn.Flatten

mindspore.nn.Flatten

差异对比

torch.nn.GELU

mindspore.nn.FastGelu

差异对比

torch.nn.KLDivLoss

mindspore.ops.KLDivLoss

torch.nn.MaxPool3d

mindspore.ops.MaxPool3D

差异对比

torch.nn.MultiheadAttention

mindspore.nn.transformer.MultiHeadAttention

差异对比

torch.nn.Module

mindspore.nn.Cell

torch.nn.Module.add_module

mindspore.nn.Cell.insert_child_to_cell

torch.nn.Module.children

mindspore.nn.Cell.cells

差异对比

torch.nn.Module.load_state_dict

mindspore.load_param_into_net

torch.nn.Module.named_children

mindspore.nn.Cell.name_cells

差异对比

torch.nn.Module.named_modules

mindspore.nn.Cell.cells_and_names

torch.nn.Module.state_dict

mindspore.nn.Cell.parameters_dict

torch.nn.Module.train

mindspore.nn.Cell.set_train

torch.nn.ModuleList

mindspore.nn.CellList

torch.nn.NLLLoss

mindspore.ops.NLLLoss

差异对比

torch.nn.Parameter

mindspore.Parameter

torch.nn.ParameterList

mindspore.ParameterTuple

差异对比

torch.nn.ReplicationPad2d

mindspore.nn.Pad

torch.nn.SELU

mindspore.ops.SeLU

torch.nn.Sequential

mindspore.nn.SequentialCell

torch.nn.SyncBatchNorm.convert_sync_batchnorm

mindspore.nn.SyncBatchNorm

torch.nn.Transformer

mindspore.nn.transformer.Transformer

差异对比

torch.nn.TransformerEncoder

mindspore.nn.transformer.TransformerEncoder

差异对比

torch.nn.TransformerDecoder

mindspore.nn.transformer.TransformerDecoder

差异对比

torch.nn.TransformerEncoderLayer

mindspore.nn.transformer.TransformerEncoderLayer

差异对比

torch.nn.TransformerDecoderLayer

mindspore.nn.transformer.TransformerDecoderLayer

差异对比

torch.nn.Upsample

mindspore.nn.ResizeBilinear

差异对比

torch.nn.functional

PyTorch 1.5.0 APIs

MindSpore APIs

说明

torch.nn.functional.adaptive_avg_pool2d

mindspore.nn.AdaptiveAvgPool2d

torch.nn.functional.avg_pool1d

mindspore.nn.AvgPool1d

torch.nn.functional.avg_pool2d

mindspore.ops.AvgPool

torch.nn.functional.avg_pool3d

mindspore.ops.AvgPool3D

torch.nn.functional.batch_norm

mindspore.ops.BatchNorm

torch.nn.functional.conv2d

mindspore.ops.Conv2D

torch.nn.functional.cosine_embedding_loss

mindspore.nn.CosineEmbeddingLoss

torch.nn.functional.ctc_loss

mindspore.ops.CTCLoss

torch.nn.functional.kl_div

mindspore.ops.KLDivLoss

torch.nn.functional.layer_norm

mindspore.ops.LayerNorm

torch.nn.functional.leaky_relu

mindspore.nn.LeakyReLU

torch.nn.functional.log_softmax

mindspore.nn.LogSoftmax

torch.nn.functional.normalize

mindspore.ops.L2Normalize

差异对比

torch.nn.functional.one_hot

mindspore.ops.OneHot

torch.nn.functional.relu

mindspore.ops.ReLU

torch.nn.functional.smooth_l1_loss

mindspore.nn.SmoothL1Loss

torch.nn.functional.softmax

mindspore.ops.Softmax

差异对比

torch.nn.functional.softplus

mindspore.ops.Softplus

torch.nn.functional.softsign

mindspore.ops.Softsign

torch.nn.init

PyTorch 1.5.0 APIs

MindSpore APIs

说明

torch.nn.init.constant_

mindspore.common.initializer.Constant

差异对比

torch.nn.init.kaiming_normal_

mindspore.common.initializer.HeNormal

torch.nn.init.kaiming_uniform_

mindspore.common.initializer.HeUniform

torch.nn.init.normal_

mindspore.common.initializer.Normal

差异对比

torch.nn.init.ones_

mindspore.common.initializer.One

torch.nn.init.xavier_uniform_

mindspore.common.initializer.XavierUniform

torch.nn.init.zeros_

mindspore.common.initializer.Zero

torch.nn.init.uniform_

mindspore.common.initializer.Uniform

差异对比

torch.optim

PyTorch 1.5.0 APIs

MindSpore APIs

说明

torch.optim.Adadelta

mindspore.ops.ApplyAdadelta

差异对比

torch.optim.Adagrad

mindspore.nn.Adagrad

差异对比

torch.optim.Adam

mindspore.nn.Adam

torch.optim.Adamax

mindspore.ops.ApplyAdaMax

torch.optim.AdamW

mindspore.nn.AdamWeightDecay

差异对比

torch.optim.Optimizer

mindspore.nn.Optimizer

差异对比

torch.optim.Optimizer.step

mindspore.nn.TrainOneStepCell

差异对比

torch.optim.RMSprop

mindspore.nn.RMSProp

torch.optim.SGD

mindspore.nn.SGD

torch.Tensor

PyTorch 1.5.0 APIs

MindSpore APIs

说明

torch.BoolTensor.all

mindspore.Tensor.all

torch.BoolTensor.any

mindspore.Tensor.any

torch.Tensor.abs

mindspore.Tensor.abs

torch.Tensor.argmax

mindspore.Tensor.argmax

torch.Tensor.argmin

mindspore.Tensor.argmin

torch.Tensor.chunk

mindspore.ops.Split

torch.Tensor.copy_

mindspore.Tensor.copy

torch.Tensor.cuda

mindspore.set_context

差异对比

torch.Tensor.cumsum

mindspore.Tensor.cumsum

torch.Tensor.diagonal

mindspore.Tensor.diagonal

torch.Tensor.dtype

mindspore.Tensor.dtype

torch.Tensor.expand

mindspore.ops.BroadcastTo

torch.Tensor.expand_as

mindspore.Tensor.expand_as

torch.Tensor.fill_

mindspore.ops.Fill

torch.Tensor.flatten

mindspore.Tensor.flatten

差异对比

torch.Tensor.float

mindspore.ops.Cast

差异对比

torch.Tensor.index_add

mindspore.ops.InplaceAdd

torch.Tensor.item

mindspore.Tensor.item

差异对比

torch.Tensor.max

mindspore.Tensor.max

torch.Tensor.mean

mindspore.Tensor.mean

torch.Tensor.min

mindspore.Tensor.min

torch.Tensor.mm

mindspore.ops.MatMul

torch.Tensor.mul

mindspore.ops.Mul

torch.Tensor.ndim

mindspore.Tensor.ndim

torch.Tensor.new_full

mindspore.numpy.full

torch.Tensor.new_zeros

mindspore.ops.Zeros

torch.Tensor.numpy

mindspore.Tensor.asnumpy

torch.Tensor.pow

mindspore.ops.Pow

torch.Tensor.permute

mindspore.ops.Transpose

torch.Tensor.repeat

mindspore.numpy.tile

差异对比

torch.Tensor.requires_grad_

mindspore.Parameter.requires_grad

torch.Tensor.reshape_as

mindspore.Tensor.reshape

torch.Tensor.resize_

mindspore.Tensor.resize

torch.Tensor.round

mindspore.ops.Round

torch.Tensor.scatter_add_

mindspore.ops.ScatterNdAdd

差异对比

torch.Tensor.sigmoid

mindspore.nn.Sigmoid

torch.Tensor.sign

mindspore.ops.Sign

torch.Tensor.size

mindspore.Tensor.shape

torch.Tensor.sqrt

mindspore.ops.Sqrt

torch.Tensor.stride

mindspore.Tensor.strides

差异对比

torch.Tensor.squeeze

mindspore.Tensor.squeeze

torch.Tensor.sub

mindspore.ops.Sub

torch.Tensor.sum

mindspore.Tensor.sum

差异对比

torch.Tensor.t

mindspore.ops.Transpose

差异对比

torch.Tensor.t

mindspore.Tensor.T

torch.Tensor.transpose

mindspore.Tensor.transpose

torch.Tensor.unsqueeze

mindspore.ops.ExpandDims

torch.Tensor.view

mindspore.Tensor.view

torch.Tensor.view_as

mindspore.Tensor.view

torch.Tensor.zero_

mindspore.ops.ZerosLike

torchtext

TorchText 0.10.0 APIs

MindSpore APIs

说明

torchtext.data.functional.custom_replace

mindspore.dataset.text.RegexReplace

torchtext.data.functional.load_sp_model

mindspore.dataset.text.SentencePieceVocab

差异对比

torchtext.data.functional.numericalize_tokens_from_iterator

mindspore.dataset.text.Lookup

差异对比

torchtext.data.functional.sentencepiece_numericalizer

mindspore.dataset.text.SentencePieceTokenizer

差异对比

torchtext.data.functional.sentencepiece_tokenizer

mindspore.dataset.text.SentencePieceTokenizer

差异对比

torchtext.data.functional.simple_space_split

mindspore.dataset.text.WhitespaceTokenizer

torchtext.data.utils.ngrams_iterator

mindspore.dataset.text.Ngram

差异对比

torchvision

TorchVision 0.10.0 APIs

MindSpore APIs

说明

torchvision.datasets.CelebA

mindspore.dataset.CelebADataset

torchvision.datasets.CIFAR10

mindspore.dataset.Cifar10Dataset

torchvision.datasets.CIFAR100

mindspore.dataset.Cifar100Dataset

torchvision.datasets.CocoDetection

mindspore.dataset.CocoDataset

差异对比

torchvision.datasets.ImageFolder

mindspore.dataset.ImageFolderDataset

torchvision.datasets.MNIST

mindspore.dataset.MnistDataset

torchvision.datasets.VOCDetection

mindspore.dataset.VOCDataset

差异对比

torchvision.datasets.VOCSegmentation

mindspore.dataset.VOCDataset

差异对比

torchvision.ops.nms

mindspore.ops.NMSWithMask

torchvision.ops.roi_align

mindspore.ops.ROIAlign

torchvision.transforms.CenterCrop

mindspore.dataset.vision.CenterCrop

torchvision.transforms.ColorJitter

mindspore.dataset.vision.RandomColorAdjust

torchvision.transforms.Compose

mindspore.dataset.transforms.Compose

torchvision.transforms.ConvertImageDtype

mindspore.dataset.transforms.TypeCast

差异对比

torchvision.transforms.FiveCrop

mindspore.dataset.vision.FiveCrop

torchvision.transforms.GaussianBlur

mindspore.dataset.vision.GaussianBlur

torchvision.transforms.Grayscale

mindspore.dataset.vision.Grayscale

torchvision.transforms.LinearTransformation

mindspore.dataset.vision.LinearTransformation

torchvision.transforms.Normalize

mindspore.dataset.vision.Normalize

torchvision.transforms.Pad

mindspore.dataset.vision.Pad

torchvision.transforms.RandomAffine

mindspore.dataset.vision.RandomAffine

torchvision.transforms.RandomApply

mindspore.dataset.transforms.RandomApply

torchvision.transforms.RandomChoice

mindspore.dataset.transforms.RandomChoice

torchvision.transforms.RandomCrop

mindspore.dataset.vision.RandomCrop

torchvision.transforms.RandomErasing

mindspore.dataset.vision.RandomErasing

torchvision.transforms.RandomGrayscale

mindspore.dataset.vision.RandomGrayscale

torchvision.transforms.RandomHorizontalFlip

mindspore.dataset.vision.RandomHorizontalFlip

torchvision.transforms.RandomOrder

mindspore.dataset.transforms.RandomOrder

torchvision.transforms.RandomPerspective

mindspore.dataset.vision.RandomPerspective

torchvision.transforms.RandomPosterize

mindspore.dataset.vision.RandomPosterize

torchvision.transforms.RandomResizedCrop

mindspore.dataset.vision.RandomResizedCrop

torchvision.transforms.RandomRotation

mindspore.dataset.vision.RandomRotation

torchvision.transforms.RandomSolarize

mindspore.dataset.vision.RandomSolarize

差异对比

torchvision.transforms.RandomVerticalFlip

mindspore.dataset.vision.RandomVerticalFlip

torchvision.transforms.Resize

mindspore.dataset.vision.Resize

torchvision.transforms.TenCrop

mindspore.dataset.vision.TenCrop

torchvision.transforms.ToPILImage

mindspore.dataset.vision.ToPIL

差异对比

torchvision.transforms.ToTensor

mindspore.dataset.vision.ToTensor

差异对比