TensorFlow与MindSpore

查看源文件

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

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

tf

TensorFlow 1.15 APIs

MindSpore APIs

说明

tf.arg_max

mindspore.Tensor.argmax

差异对比

tf.arg_min

mindspore.Tensor.argmin

差异对比

tf.clip_by_value

mindspore.Tensor.clip

差异对比

tf.expand_dims

mindspore.ops.ExpandDims

tf.eye

mindspore.ops.Eye

tf.fill

mindspore.ops.Fill

tf.gather

mindspore.ops.Gather

tf.gradients

mindspore.ops.GradOperation

差异对比

tf.norm

mindspore.nn.Norm

tf.one_hot

mindspore.nn.OneHot

tf.ones_like

mindspore.ops.OnesLike

tf.pad

mindspore.nn.Pad

tf.print

mindspore.ops.Print

tf.repeat

mindspore.Tensor.repeat

tf.reshape

mindspore.ops.Reshape

tf.reshape

mindspore.Tensor.reshape

tf.shape

mindspore.ops.Shape

tf.size

mindspore.ops.Size

tf.slice

mindspore.ops.Slice

tf.squeeze

mindspore.Tensor.squeeze

tf.stop_gradient

mindspore.ops.stop_gradient

tf.Tensor

mindspore.Tensor

tf.tile

mindspore.ops.Tile

tf.transpose

mindspore.ops.Transpose

tf.zeros_like

mindspore.ops.ZerosLike

tf.distribute

TensorFlow 1.15 APIs

MindSpore APIs

说明

tf.distribute.Strategy

context.set_auto_parallel_context(parallel_mode=ParallelMode.DATA_PARALLEL)

差异对比

tf.image

TensorFlow 1.15 APIs

MindSpore APIs

说明

tf.image.ssim

mindspore.nn.SSIM

tf.keras

TensorFlow 1.15 APIs

MindSpore APIs

说明

tf.keras.initializers.Constant

mindspore.common.initializer.Constant

差异对比

tf.keras.initializers.Ones

mindspore.common.initializer.One

tf.keras.initializers.RandomNormal

mindspore.common.initializer.Normal

差异对比

tf.keras.initializers.TruncatedNormal

mindspore.common.initializer.TruncatedNormal

差异对比

tf.keras.initializers.RandomUniform

mindspore.common.initializer.Uniform

差异对比

tf.keras.initializers.VarianceScaling

mindspore.common.initializer.XavierUniform

差异对比

tf.keras.initializers.Zeros

mindspore.common.initializer.Zero

tf.keras.backend.batch_dot

mindspore.ops.batch_dot

tf.keras.backend.dot

mindspore.ops.dot

tf.keras.layers.Embedding

mindspore.nn.Embedding

tf.keras.layers.Flatten

mindspore.nn.Flatten

tf.keras.layers.LayerNormalization

mindspore.nn.LayerNorm

tf.keras.layers.LSTM

mindspore.nn.LSTM

tf.keras.layers.PReLU

mindspore.nn.PReLU

tf.keras.layers.RNN

mindspore.ops.DynamicRNN

tf.keras.Model

mindspore.Model

差异对比

tf.keras.Model.fit
tf.keras.Model.fit_generator

mindspore.Model.train

差异对比

tf.keras.Model.predict
tf.keras.Model.predict_generator

mindspore.Model.eval

差异对比

tf.keras.optimizers.Adagrad

mindspore.nn.Adagrad

差异对比

tf.keras.optimizers.Adam

mindspore.nn.Adam

差异对比

tf.keras.optimizers.Ftrl

mindspore.nn.FTRL

差异对比

tf.keras.optimizers.RMSprop

mindspore.nn.RMSProp

差异对比

tf.keras.optimizers.SGD

mindspore.nn.SGD

差异对比

tf.keras.metrics.Accuracy
tf.keras.metrics.BinaryAccuracy
tf.keras.metrics.CategoricalAccuracy
tf.keras.metrics.SparseCategoricalAccuracy

mindspore.nn.Accuracy

差异对比

tf.keras.metrics.AUC

mindspore.nn.auc

差异对比

tf.keras.metrics.CosineSimilarity

mindspore.nn.CosineSimilarity

差异对比

tf.keras.metrics.Mean

mindspore.nn.Loss

tf.keras.metrics.MeanAbsoluteError

mindspore.nn.MAE

tf.keras.metrics.MeanSquaredError

mindspore.nn.MSE

tf.keras.metrics.Precision

mindspore.nn.Precision

差异对比

tf.keras.metrics.Recall

mindspore.nn.Recall

差异对比

tf.layers

TensorFlow 1.15 APIs

MindSpore APIs

说明

tf.layers.Dense

mindspore.nn.Dense

tf.linalg

TensorFlow 1.15 APIs

MindSpore APIs

说明

tf.linalg.inv

mindspore.ops.Inv

tf.linalg.matmul

mindspore.nn.MatMul

tf.math

TensorFlow 1.15 APIs

MindSpore APIs

说明

tf.math.add

mindspore.ops.Add

tf.math.cumsum

mindspore.Tensor.cumsum

差异对比

tf.math.divide

mindspore.ops.Div

tf.math.erf

mindspore.ops.Erf

tf.math.greater

mindspore.ops.Greater

tf.math.less_equal

mindspore.ops.LessEqual

tf.math.log

mindspore.ops.Log

tf.math.multiply

mindspore.ops.Mul

tf.math.pow

mindspore.ops.Pow

tf.math.reduce_std

mindspore.Tensor.std

差异对比

tf.math.reduce_sum

mindspore.Tensor.sum

差异对比

tf.math.reduce_variance

mindspore.Tensor.var

差异对比

tf.math.sigmoid

mindspore.nn.Sigmoid

tf.math.subtract

mindspore.ops.Sub

tf.metrics

TensorFlow 1.15 APIs

MindSpore APIs

说明

tf.metrics.mean_iou

mindspore.ops.IOU

tf.nn

TensorFlow 1.15 APIs

MindSpore APIs

说明

tf.nn.avg_pool2d

mindspore.nn.AvgPool2d

tf.nn.batch_normalization

mindspore.ops.BatchNorm

tf.nn.bias_add

mindspore.ops.BiasAdd

tf.nn.conv2d

mindspore.nn.Conv2d

tf.nn.conv2d_transpose

mindspore.nn.Conv2dTranspose

tf.nn.ctc_loss

mindspore.ops.CTCLoss

tf.nn.dropout

mindspore.nn.Dropout

tf.nn.elu

mindspore.nn.ELU

tf.nn.l2_loss

mindspore.ops.L2Loss

tf.nn.l2_normalize

mindspore.ops.L2Normalize

tf.nn.leaky_relu

mindspore.nn.LeakyReLU

tf.nn.max_pool_with_argmax

mindspore.ops.MaxPoolWithArgmax

tf.nn.max_pool2d

mindspore.nn.MaxPool2d

tf.nn.moments

mindspore.nn.Moments

tf.nn.relu

mindspore.nn.ReLU

tf.nn.selu

mindspore.ops.SeLU

tf.nn.sigmoid_cross_entropy_with_logits

mindspore.ops.SigmoidCrossEntropyWithLogits

tf.nn.softmax

mindspore.nn.Softmax

tf.nn.softmax_cross_entropy_with_logits

mindspore.nn.SoftmaxCrossEntropyWithLogits

差异对比

tf.random

TensorFlow 1.15 APIs

MindSpore APIs

说明

tf.random.gamma

mindspore.ops.Gamma

tf.random.uniform

mindspore.ops.uniform

tf.sparse

TensorFlow 1.15 APIs

MindSpore APIs

说明

tf.sparse.SparseTensor

mindspore.SparseTensor

tf.train

TensorFlow 1.15 APIs

MindSpore APIs

说明

tf.train.ProximalAdagradOptimizer

mindspore.nn.ProximalAdagrad

差异对比

tf.train.exponential_decay

mindspore.nn.ExponentialDecayLR

tf.train.linear_cosine_decay

mindspore.nn.CosineDecayLR

差异对比

tf.train.MomentumOptimizer

mindspore.nn.Momentum

差异对比

tfp

TensorFlow Probability 0.14.1 APIs

MindSpore APIs

说明

tfp.bijectors.Softplus

mindspore.nn.probability.bijector.Softplus

差异对比