TensorFlow-Fluid 常用接口对应表

本文档基于 TensorFlow v1.13 梳理了常用 API 与 PaddlePaddle API 对应关系和差异分析。根据文档对应关系,有 TensorFlow 使用经验的用户,可根据对应关系,快速熟悉 PaddlePaddle 的接口使用。

序号

TensorFlow 接口

Fluid 接口

备注

1

tf.abs

cn_api_fluid_layers_abs

功能一致

2

tf.add

cn_api_fluid_layers_elementwise_add

功能一致

3

tf.argmax

cn_api_fluid_layers_argmax

功能一致

4

tf.argmin

cn_api_fluid_layers_argmin

功能一致

5

tf.assign

cn_api_fluid_layers_assign

功能一致

6

tf.assign_add

cn_api_fluid_layers_increment

功能一致

7

tf.case

cn_api_fluid_layers_Switch

差异对比

8

tf.cast

cn_api_fluid_layers_cast

功能一致

9

tf.clip_by_global_norm

cn_api_fluid_clip_GradientClipByGlobalNorm

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

10

tf.clip_by_norm

cn_api_fluid_layers_clip_by_norm

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

11

tf.clip_by_value

cn_api_fluid_layers_clip

功能一致

12

tf.concat

cn_api_fluid_layers_concat

功能一致

13

tf.cond

cn_api_fluid_layers_ifElse

功能一致

14

tf.constant

cn_api_fluid_layers_fill_constant

功能一致

15

tf.contrib.layers.batch_norm

cn_api_fluid_layers_batch_norm

功能一致

16

tf.contrib.layers.flatten

cn_api_fluid_layers_flatten

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

17

tf.contrib.layers.fully_connected

cn_api_fluid_layers_fc

功能一致

18

tf.contrib.layers.one_hot_encoding

cn_api_fluid_layers_one_hot

功能一致

19

tf.contrib.layers.softmax

cn_api_fluid_layers_softmax

功能一致

20

tf.contrib.layers.xavier_initializer

cn_api_fluid_initializer_Xavier

功能一致

21

tf.nn.rnn.GRUCell

cn_api_fluid_layers_gru_unit

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

22

tf.nn.rnn.MultiRNNCell

无相应接口

Fluid 实现

23

tf.nn.rnn.static_rnn

cn_api_fluid_layers_DynamicRNN

功能一致

24

tf.convert_to_tensor

cn_api_fluid_layers_assign

功能一致

25

tf.cos

cn_api_fluid_layers_cos

功能一致

26

tf.div

cn_api_fluid_layers_elementwise_div

功能一致

27

tf.divide

cn_api_fluid_layers_elementwise_div

功能一致

28

tf.dropout

cn_api_fluid_layers_dropout

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

29

tf.equal

运算符==

功能一致

30

tf.exp

cn_api_fluid_layers_exp

功能一致

31

tf.expand_dims

cn_api_fluid_layers_unsqueeze

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

32

tf.fill

cn_api_fluid_layers_fill_constant

功能一致

33

tf.floor

cn_api_fluid_layers_floor

功能一致

34

tf.gather

cn_api_fluid_layers_gather

功能一致

35

tf.greater

运算符>

功能一致

36

tf.greater_equal

运算符>=

功能一致

37

tf.image.non_max_suppression

cn_api_fluid_layers_multiclass_nms

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

38

tf.image.resize_bilinear

cn_api_fluid_layers_resize_bilinear

功能一致

39

tf.image.resize_images

cn_api_fluid_layers_image_resize

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

40

tf.image.resize_nearest_neighbor

cn_api_fluid_layers_resize_nearest

功能一致

41

tf.is_finite

cn_api_fluid_layers_isfinite

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

42

tf.layers.batch_normalization

cn_api_fluid_layers_batch_norm

功能一致

43

tf.layers.conv2d

cn_api_fluid_layers_conv2d

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

44

tf.layers.dense

cn_api_fluid_layers_fc

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

45

tf.layers.dropout

cn_api_fluid_layers_dropout

功能一致

46

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “tf.layers.dropout”.

tf.layers.Dropout

cn_api_fluid_layers_dropout

功能一致

47

tf.layers.flatten

cn_api_fluid_layers_flatten

功能一致

48

tf.less

运算符<

功能一致

49

tf.less_equal

运算符<=

功能一致

50

tf.log

cn_api_fluid_layers_log

功能一致

51

tf.logical_and

cn_api_fluid_layers_logical_and

功能一致

52

tf.logical_not

cn_api_fluid_layers_logical_not

功能一致

53

tf.logical_or

cn_api_fluid_layers_logical_or

功能一致

54

tf.losses.mean_squared_error

cn_api_fluid_layers_square_error_cost

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

55

tf.losses.sigmoid_cross_entropy

cn_api_fluid_layers_sigmoid_cross_entropy_with_logits

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

56

tf.losses.softmax_cross_entropy

cn_api_fluid_layers_softmax_with_cross_entropy

功能一致

57

tf.matmul

cn_api_fluid_layers_matmul

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

58

tf.maximum

cn_api_fluid_layers_elementwise_max

功能一致

59

tf.metrics.accuracy

cn_api_fluid_layers_accuracy

功能一致

60

tf.metrics.mean

cn_api_fluid_layers_mean

功能一致

61

tf.minimum

cn_api_fluid_layers_elementwise_min

功能一致

62

tf.multiply

cn_api_fluid_layers_elementwise_mul

功能一致

63

tf.nn.avg_pool

cn_api_fluid_layers_pool2d

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

64

tf.nn.batch_normalization

cn_api_fluid_layers_batch_norm

功能一致

65

tf.nn.bidirectional_dynamic_rnn

无相应接口

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “fluid 实现”.

Fluid 实现

66

tf.nn.conv2d

cn_api_fluid_layers_conv2d

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

67

tf.nn.conv2d_transpose

cn_api_fluid_layers_conv2d_transpose

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

68

tf.nn.conv3d_transpose

cn_api_fluid_layers_conv3d_transpose

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

69

tf.nn.depthwise_conv2d

cn_api_fluid_layers_conv2d

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

70

tf.nn.dynamic_rnn

cn_api_fluid_layers_DynamicRNN

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

71

tf.nn.l2_normalize

cn_api_fluid_layers_l2_normalize

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

72

tf.nn.leaky_relu

cn_api_fluid_layers_leaky_relu

功能一致

73

tf.nn.lrn

cn_api_fluid_layers_lrn

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

74

tf.nn.max_pool

cn_api_fluid_layers_pool2d

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

75

tf.nn.relu

cn_api_fluid_layers_relu

功能一致

76

tf.nn.relu6

cn_api_fluid_layers_relu6

功能一致

77

tf.nn.rnn_cell.LSTMCell

cn_api_fluid_layers_lstm_unit

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

78

tf.nn.separable_conv2d

无相应接口

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “fluid 实现”.

Fluid 实现

79

tf.nn.sigmoid

cn_api_fluid_layers_sigmoid

功能一致

80

tf.nn.sigmoid_cross_entropy_with_logits

cn_api_fluid_layers_sigmoid_cross_entropy_with_logits

功能一致

81

tf.nn.softmax

cn_api_fluid_layers_softmax

功能一致

82

tf.nn.softmax_cross_entropy_with_logits

cn_api_fluid_layers_softmax_with_cross_entropy

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

83

tf.nn.softplus

cn_api_fluid_layers_softplus

功能一致

84

tf.nn.softsign

cn_api_fluid_layers_softsign

功能一致

85

tf.nn.tanh

cn_api_fluid_layers_tanh

功能一致

86

tf.one_hot

cn_api_fluid_layers_one_hot

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

87

tf.ones

cn_api_fluid_layers_ones

功能一致

88

tf.intializers.ones

cn_api_fluid_initializer_Constant

功能一致

89

tf.pad

cn_api_fluid_layers_pad

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

90

tf.placeholder

cn_api_fluid_layers_data

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

91

tf.pow

cn_api_fluid_layers_pow

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

92

tf.print

cn_api_fluid_layers_print

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

93

tf.py_func

cn_api_fluid_layers_py_func

功能一致

94

tf.random_normal

cn_api_fluid_layers_gaussian_random

功能一致

95

tf.random_normal_initializer

cn_api_fluid_initializer_Normal

功能一致

96

tf.random_uniform

cn_api_fluid_layers_uniform_random

功能一致

97

tf.random_uniform_initializer

cn_api_fluid_initializer_UniformInitializer

功能一致

98

tf.reduce_logsumexp

无相应接口

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “fluid 实现”.

Fluid 实现

99

tf.reduce_max

cn_api_fluid_layers_reduce_max

功能一致

100

tf.reduce_mean

cn_api_fluid_layers_reduce_mean

功能一致

101

tf.reduce_min

cn_api_fluid_layers_reduce_min

功能一致

102

tf.reduce_sum

cn_api_fluid_layers_reduce_sum

功能一致

103

tf.reshape

cn_api_fluid_layers_reshape

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

104

tf.reverse

cn_api_fluid_layers_reverse

功能一致

105

tf.reverse_sequence

cn_api_fluid_layers_sequence_reverse

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

106

tf.reverse_v2

cn_api_fluid_layers_reverse

功能一致

107

tf.round

cn_api_fluid_layers_round

功能一致

108

tf.rsqrt

cn_api_fluid_layers_rsqrt

功能一致

109

tf.scalar_mul

cn_api_fluid_layers_scale

功能一致

110

tf.scatter_update

cn_api_fluid_layers_scatter

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

111

tf.sequence_mask

cn_api_fluid_layers_sequence_mask

功能一致

112

tf.shape

cn_api_fluid_layers_shape

功能一致

113

tf.sigmoid

cn_api_fluid_layers_sigmoid

功能一致

114

tf.sin

cn_api_fluid_layers_sin

功能一致

115

tf.slice

cn_api_fluid_layers_slice

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

116

tf.split

cn_api_fluid_layers_split

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

117

tf.sqrt

cn_api_fluid_layers_sqrt

功能一致

118

tf.square

cn_api_fluid_layers_square

功能一致

119

tf.squared_difference

无相应接口

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “fluid 实现”.

Fluid 实现

120

tf.squeeze

cn_api_fluid_layers_squeeze

功能一致

121

tf.stack

cn_api_fluid_layers_stack

功能一致

122

tf.stop_gradient

无相应接口

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “fluid 实现”.

Fluid 实现

123

tf.subtract

cn_api_fluid_layers_elementwise_sub

功能一致

124

tf.tanh

cn_api_fluid_layers_tanh

功能一致

125

tf.tile

cn_api_fluid_layers_expand

功能一致

126

tf.top_k

cn_api_fluid_layers_topk

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

127

tf.train.AdagradOptimizer

cn_api_fluid_optimizer_AdagradOptimizer

功能一致

128

tf.train.AdamOptimizer

cn_api_fluid_optimizer_Adam

功能一致

129

tf.train.exponential_decay

cn_api_fluid_layers_exponential_decay

功能一致

130

tf.train.GradientDescentOptimizer

cn_api_fluid_optimizer_SGDOptimizer

功能一致

131

tf.train.MomentumOptimizer

cn_api_fluid_optimizer_MomentumOptimizer

功能一致

132

tf.train.polynomial_decay

cn_api_fluid_layers_polynomial_decay

功能一致

133

tf.train.RMSPropOptimizer

cn_api_fluid_optimizer_RMSPropOptimizer

功能一致

134

tf.transpose

cn_api_fluid_layers_transpose

功能一致

135

tf.truediv

cn_api_fluid_layers_elementwise_div

功能一致

136

tf.truncated_normal

cn_api_fluid_initializer_TruncatedNormal

功能一致

137

tf.truncated_normal_initializer

cn_api_fluid_initializer_TruncatedNormal

功能一致

138

tf.unstack

cn_api_fluid_layers_unstack

功能一致

139

tf.Variable

cn_api_fluid_layers_create_parameter

功能一致

140

tf.while_loop

cn_api_fluid_layers_While

System Message: WARNING/2 (/FluidDoc/docs/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

Duplicate explicit target name: “差异对比”.

差异对比

141

tf.zeros

cn_api_fluid_layers_zeros

功能一致

142

tf.zeros_initializer

cn_api_fluid_initializer_Constant

功能一致