TensorFlow-Fluid常用接口对应表

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

序号

TensorFlow接口

Fluid接口

备注

1

tf.abs

abs

功能一致

2

tf.add

elementwise_add

功能一致

3

tf.argmax

argmax

功能一致

4

tf.argmin

argmin

功能一致

5

tf.assign

assign

功能一致

6

tf.assign_add

increment

功能一致

7

tf.case

Switch

差异对比

8

tf.cast

cast

功能一致

9

tf.clip_by_global_norm

cn_api_fluid_clip_GradientClipByGlobalNorm

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

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

差异对比

10

tf.clip_by_norm

clip_by_norm

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

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

差异对比

11

tf.clip_by_value

clip

功能一致

12

tf.concat

concat

功能一致

13

tf.cond

IfElse

功能一致

14

tf.constant

fill_constant

功能一致

15

tf.contrib.layers.batch_norm

batch_norm

功能一致

16

tf.contrib.layers.flatten

flatten

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

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

差异对比

17

tf.contrib.layers.fully_connected

fc

功能一致

18

tf.contrib.layers.one_hot_encoding

one_hot

功能一致

19

tf.contrib.layers.softmax

softmax

功能一致

20

tf.contrib.layers.xavier_initializer

Xavier

功能一致

21

tf.nn.rnn.GRUCell

gru_unit

System Message: WARNING/2 (/FluidDoc/doc/paddle/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

DynamicRNN

功能一致

24

tf.convert_to_tensor

assign

功能一致

25

tf.cos

cos

功能一致

26

tf.div

elementwise_div

功能一致

27

tf.divide

elementwise_div

功能一致

28

tf.dropout

dropout

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

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

差异对比

29

tf.equal

运算符==

功能一致

30

tf.exp

exp

功能一致

31

tf.expand_dims

unsqueeze

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

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

差异对比

32

tf.fill

fill_constant

功能一致

33

tf.floor

floor

功能一致

34

tf.gather

gather

功能一致

35

tf.greater

运算符>

功能一致

36

tf.greater_equal

运算符>=

功能一致

37

tf.image.non_max_suppression

multiclass_nms

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

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

差异对比

38

tf.image.resize_bilinear

resize_bilinear

功能一致

39

tf.image.resize_images

image_resize

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

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

差异对比

40

tf.image.resize_nearest_neighbor

resize_nearest

功能一致

41

tf.is_finite

isfinite

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

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

差异对比

42

tf.layers.batch_normalization

batch_norm

功能一致

43

tf.layers.conv2d

conv2d

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

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

差异对比

44

tf.layers.dense

fc

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

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

差异对比

45

tf.layers.dropout

dropout

功能一致

46

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

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

tf.layers.Dropout

dropout

功能一致

47

tf.layers.flatten

flatten

功能一致

48

tf.less

运算符<

功能一致

49

tf.less_equal

运算符<=

功能一致

50

tf.log

log

功能一致

51

tf.logical_and

logical_and

功能一致

52

tf.logical_not

logical_not

功能一致

53

tf.logical_or

logical_or

功能一致

54

tf.losses.mean_squared_error

square_error_cost

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

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

差异对比

55

tf.losses.sigmoid_cross_entropy

sigmoid_cross_entropy_with_logits

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

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

差异对比

56

tf.losses.softmax_cross_entropy

softmax_with_cross_entropy

功能一致

57

tf.matmul

matmul

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

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

差异对比

58

tf.maximum

elementwise_max

功能一致

59

tf.metrics.accuracy

accuracy

功能一致

60

tf.metrics.mean

mean

功能一致

61

tf.minimum

elementwise_min

功能一致

62

tf.multiply

cn_api_fluid_layers_elementwise_mul

功能一致

63

tf.nn.avg_pool

pool2d

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

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

差异对比

64

tf.nn.batch_normalization

batch_norm

功能一致

65

tf.nn.bidirectional_dynamic_rnn

无相应接口

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

Duplicate explicit target name: “fluid实现”.

Fluid实现

66

tf.nn.conv2d

conv2d

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

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

差异对比

67

tf.nn.conv2d_transpose

conv2d_transpose

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

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

差异对比

68

tf.nn.conv3d_transpose

conv3d_transpose

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

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

差异对比

69

tf.nn.depthwise_conv2d

conv2d

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

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

差异对比

70

tf.nn.dynamic_rnn

DynamicRNN

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

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

差异对比

71

tf.nn.l2_normalize

l2_normalize

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

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

差异对比

72

tf.nn.leaky_relu

leaky_relu

功能一致

73

tf.nn.lrn

lrn

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

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

差异对比

74

tf.nn.max_pool

pool2d

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

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

差异对比

75

tf.nn.relu

relu

功能一致

76

tf.nn.relu6

relu6

功能一致

77

tf.nn.rnn_cell.LSTMCell

lstm_unit

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

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

差异对比

78

tf.nn.separable_conv2d

无相应接口

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

Duplicate explicit target name: “fluid实现”.

Fluid实现

79

tf.nn.sigmoid

sigmoid

功能一致

80

tf.nn.sigmoid_cross_entropy_with_logits

sigmoid_cross_entropy_with_logits

功能一致

81

tf.nn.softmax

softmax

功能一致

82

tf.nn.softmax_cross_entropy_with_logits

softmax_with_cross_entropy

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

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

差异对比

83

tf.nn.softplus

softplus

功能一致

84

tf.nn.softsign

softsign

功能一致

85

tf.nn.tanh

tanh

功能一致

86

tf.one_hot

one_hot

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

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

差异对比

87

tf.ones

ones

功能一致

88

tf.intializers.ones

Constant

功能一致

89

tf.pad

pad

System Message: WARNING/2 (/FluidDoc/doc/paddle/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/doc/paddle/api_guides/X2Paddle/TensorFlow-Fluid.rst, line 5); backlink

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

差异对比

91

tf.pow

pow

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

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

差异对比

92

tf.print

Print

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

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

差异对比

93

tf.py_func

py_func

功能一致

94

tf.random_normal

gaussian_random

功能一致

95

tf.random_normal_initializer

cn_api_fluid_initializer_Normal

功能一致

96

tf.random_uniform

uniform_random

功能一致

97

tf.random_uniform_initializer

cn_api_fluid_initializer_UniformInitializer

功能一致

98

tf.reduce_logsumexp

无相应接口

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

Duplicate explicit target name: “fluid实现”.

Fluid实现

99

tf.reduce_max

reduce_max

功能一致

100

tf.reduce_mean

reduce_mean

功能一致

101

tf.reduce_min

reduce_min

功能一致

102

tf.reduce_sum

reduce_sum

功能一致

103

tf.reshape

reshape

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

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

差异对比

104

tf.reverse

reverse

功能一致

105

tf.reverse_sequence

sequence_reverse

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

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

差异对比

106

tf.reverse_v2

reverse

功能一致

107

tf.round

round

功能一致

108

tf.rsqrt

rsqrt

功能一致

109

tf.scalar_mul

scale

功能一致

110

tf.scatter_update

scatter

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

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

差异对比

111

tf.sequence_mask

sequence_mask

功能一致

112

tf.shape

shape

功能一致

113

tf.sigmoid

sigmoid

功能一致

114

tf.sin

sin

功能一致

115

tf.slice

slice

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

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

差异对比

116

tf.split

split

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

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

差异对比

117

tf.sqrt

sqrt

功能一致

118

tf.square

square

功能一致

119

tf.squared_difference

无相应接口

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

Duplicate explicit target name: “fluid实现”.

Fluid实现

120

tf.squeeze

squeeze

功能一致

121

tf.stack

stack

功能一致

122

tf.stop_gradient

无相应接口

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

Duplicate explicit target name: “fluid实现”.

Fluid实现

123

tf.subtract

elementwise_sub

功能一致

124

tf.tanh

tanh

功能一致

125

tf.tile

expand

功能一致

126

tf.top_k

topk

System Message: WARNING/2 (/FluidDoc/doc/paddle/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

exponential_decay

功能一致

130

tf.train.GradientDescentOptimizer

SGDOptimizer

功能一致

131

tf.train.MomentumOptimizer

MomentumOptimizer

功能一致

132

tf.train.polynomial_decay

polynomial_decay

功能一致

133

tf.train.RMSPropOptimizer

cn_api_fluid_optimizer_RMSPropOptimizer

功能一致

134

tf.transpose

transpose

功能一致

135

tf.truediv

elementwise_div

功能一致

136

tf.truncated_normal

TruncatedNormal

功能一致

137

tf.truncated_normal_initializer

TruncatedNormal

功能一致

138

tf.unstack

unstack

功能一致

139

tf.Variable

create_parameter

功能一致

140

tf.while_loop

While

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

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

差异对比

141

tf.zeros

zeros

功能一致

142

tf.zeros_initializer

Constant

功能一致