From ede3f48568c4fe36cecbbb5a8ed1aecb239fb928 Mon Sep 17 00:00:00 2001 From: jiangjiajun Date: Fri, 28 Jun 2019 13:35:51 +0800 Subject: [PATCH] update tf2fluid/doc --- tensorflow2fluid/doc/ReadMe.md | 10 +-- tensorflow2fluid/doc/compare_op.md | 10 +-- tensorflow2fluid/doc/tf.case.md | 4 +- .../doc/tf.clip_by_global_norm.md | 4 +- tensorflow2fluid/doc/tf.clip_by_norm.md | 4 +- .../doc/tf.contrib.layers.flatten.md | 4 +- .../doc/tf.contrib.rnn.GRUCell.md | 84 ------------------- tensorflow2fluid/doc/tf.expand_dims.md | 6 +- .../doc/tf.image.non_max_suppression.md | 5 +- .../doc/tf.image.resize_images.md | 6 +- tensorflow2fluid/doc/tf.layers.conv2d.md | 7 +- tensorflow2fluid/doc/tf.layers.dense.md | 5 +- .../doc/tf.losses.mean_and_squared_error.md | 4 +- .../doc/tf.losses.sigmoid_cross_entropy.md | 4 +- tensorflow2fluid/doc/tf.math.is_finite.md | 5 +- tensorflow2fluid/doc/tf.math.rsqrt.md | 4 +- tensorflow2fluid/doc/tf.matmul.md | 5 +- tensorflow2fluid/doc/tf.nn.avg_pool.md | 2 +- .../doc/tf.nn.bidirectional_dynamic_rnn.md | 4 +- tensorflow2fluid/doc/tf.nn.conv2d.md | 4 +- .../doc/tf.nn.conv2d_transpose.md | 5 +- .../doc/tf.nn.conv3d_transpose.md | 5 +- .../doc/tf.nn.depthwise_conv2d.md | 4 +- tensorflow2fluid/doc/tf.nn.dropout.md | 5 +- tensorflow2fluid/doc/tf.nn.dynamic_rnn.md | 4 +- tensorflow2fluid/doc/tf.nn.l2_normalize.md | 5 +- tensorflow2fluid/doc/tf.nn.lrn.md | 5 +- tensorflow2fluid/doc/tf.nn.max_pool.md | 4 +- .../doc/tf.nn.reduce_logsumexp.md | 4 +- .../doc/tf.nn.rnn_cell.LSTMCell.md | 4 +- .../doc/tf.nn.rnn_cell.MultiRNNCell.md | 4 +- .../doc/tf.nn.separable_conv2d.md | 4 +- ...tf.nn.softmax_cross_entropy_with_logits.md | 5 +- tensorflow2fluid/doc/tf.nn.top_k.md | 5 +- tensorflow2fluid/doc/tf.one_hot.md | 5 +- tensorflow2fluid/doc/tf.pad.md | 5 +- tensorflow2fluid/doc/tf.placeholder.md | 5 +- tensorflow2fluid/doc/tf.pow.md | 4 +- tensorflow2fluid/doc/tf.print.md | 4 +- tensorflow2fluid/doc/tf.reshape.md | 6 +- tensorflow2fluid/doc/tf.reverse_sequence.md | 4 +- tensorflow2fluid/doc/tf.scatter_update.md | 7 +- tensorflow2fluid/doc/tf.slice.md | 5 +- tensorflow2fluid/doc/tf.split.md | 4 +- tensorflow2fluid/doc/tf.squared_difference.md | 4 +- tensorflow2fluid/doc/tf.stop_gradient.md | 5 +- tensorflow2fluid/doc/tf.while_loop.md | 4 +- 47 files changed, 101 insertions(+), 205 deletions(-) delete mode 100644 tensorflow2fluid/doc/tf.contrib.rnn.GRUCell.md diff --git a/tensorflow2fluid/doc/ReadMe.md b/tensorflow2fluid/doc/ReadMe.md index 452fb61..acdabea 100644 --- a/tensorflow2fluid/doc/ReadMe.md +++ b/tensorflow2fluid/doc/ReadMe.md @@ -24,9 +24,9 @@ | 18 | [tf.contrib.layers.one_hot_encoding](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/contrib/layers/one_hot_encoding) | [fluid.layers.one_hot](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#one_hot) | 功能一致 | | 19 | [tf.contrib.layers.softmax](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/contrib/layers/softmax) | [fluid.layers.softmax](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#softmax) | 功能一致 | | 20 | [tf.contrib.layers.xavier_initializer](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/contrib/layers/xavier_initializer) | [fluid.initializer.Xavier](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/initializer_cn.html#xavier) | 功能一致 | -| 21 | [tf.contrib.rnn.GRUCell](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/contrib/rnn/GRUCell) | [fluid.layers.gru_unit](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#gru_unit) | [差异对比](https://github.com/PaddlePaddle/X2Paddle/blob/master/tensorflow2fluid/doc/tf.contrib.rnn.GRUCell.md) | -| 22 | [tf.contrib.rnn.MultiRNNCell](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/contrib/rnn/MultiRNNCell) | 无相应接口 | [Paddle实现方法](https://github.com/PaddlePaddle/X2Paddle/blob/master/tensorflow2fluid/doc/tf.nn.rnn_cell.MultiRNNCell.md) | -| 23 | [tf.contrib.rnn.static_rnn](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/contrib/rnn/static_rnn) | [fluid.layers.DynamicRNN](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#dynamicrnn) | 功能一致 | +| 21 | [tf.nn.rnn.GRUCell](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/rnn_cell/GRUCell) | [fluid.layers.gru_unit](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#gru_unit) | [差异对比](https://github.com/PaddlePaddle/X2Paddle/blob/master/tensorflow2fluid/doc/tf.contrib.rnn.GRUCell.md) | +| 22 | [tf.nn.rnn.MultiRNNCell](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/rnn_cell/MultiRNNCell) | 无相应接口 | [Paddle实现方法](https://github.com/PaddlePaddle/X2Paddle/blob/master/tensorflow2fluid/doc/tf.nn.rnn_cell.MultiRNNCell.md) | +| 23 | [tf.nn.rnn.static_rnn](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/static_rnn) | [fluid.layers.DynamicRNN](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#dynamicrnn) | 功能一致 | | 24 | [tf.convert_to_tensor](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/convert_to_tensor) | [fluid.layers.assign](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#assign) | 功能一致 | | 25 | [tf.cos](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/math/cos) | [fluid.layers.cos](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#cos) | 功能一致 | | 26 | [tf.div](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/div) | [fluid.layers.elementwise_div](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#paddle.fluid.layers.elementwise_div) | 功能一致 | @@ -91,7 +91,7 @@ | 85 | [tf.nn.tanh](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/math/tanh) | [fluid.layers.tanh](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#tanh) | 功能一致 | | 86 | [tf.one_hot](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/one_hot) | [fluid.layers.one_hot](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#paddle.fluid.layers.one_hot) | [差异对比](https://github.com/PaddlePaddle/X2Paddle/blob/master/tensorflow2fluid/doc/tf.one_hot.md) | | 87 | [tf.ones](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/ones) | [fluid.layers.ones](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#ones) | 功能一致 | -| 88 | [tf.ones_initializer](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/ones_initializer) | [fluid.initializer.Constant](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/initializer_cn.html#constant) | 功能一致 | +| 88 | [tf.intializers.ones](https://www.tensorflow.org/versions/r1.14/api_docs/python/tf/initializers/ones) | [fluid.initializer.Constant](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/initializer_cn.html#constant) | 功能一致 | | 89 | [tf.pad](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/pad) | [fluid.layers.pad](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#pad) | [差异对比](https://github.com/PaddlePaddle/X2Paddle/blob/master/tensorflow2fluid/doc/tf.pad.md) | | 90 | [tf.placeholder](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/placeholder) | [fluid.layers.data](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#paddle.fluid.layers.data) | [差异对比](https://github.com/PaddlePaddle/X2Paddle/blob/master/tensorflow2fluid/doc/tf.placeholder.md) | | 91 | [tf.pow](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/math/pow) | [fluid.layers.pow](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#pow) | [差异对比](https://github.com/PaddlePaddle/X2Paddle/blob/master/tensorflow2fluid/doc/tf.pow.md) | @@ -145,4 +145,4 @@ | 139 | [tf.Variable](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/Variable) | [fluid.layers.create_parameter](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#create_parameter) | 功能一致 | | 140 | [tf.while_loop](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/while_loop) | [fluid.layers.While](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#While) | [差异对比](https://github.com/PaddlePaddle/X2Paddle/blob/master/tensorflow2fluid/doc/tf.while_loop.md) | | 141 | [tf.zeros](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/zeros) | [fluid.layers.zeros](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#zeros) | 功能一致 | -| 142 | [tf.zeros_initializer](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/zeros_initializer) | [fluid.initializer.Constant](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/initializer_cn.html#constant) | 功能一致 | +| 142 | [tf.zeros_initializer](https://www.tensorflow.org/versions/r1.14/api_docs/python/tf/zeros_initializer) | [fluid.initializer.Constant](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/initializer_cn.html#constant) | 功能一致 | diff --git a/tensorflow2fluid/doc/compare_op.md b/tensorflow2fluid/doc/compare_op.md index 3e2db93..57e9d9b 100644 --- a/tensorflow2fluid/doc/compare_op.md +++ b/tensorflow2fluid/doc/compare_op.md @@ -4,8 +4,8 @@ | TensorFlow接口 | PaddlePaddle接口 | |--------------------------|-------------------------------------------------| -|[tf.math.less_equal](https://www.tensorflow.org/api_docs/python/tf/math/less_equal)|运算符`<=`| -|[tf.math.greater](https://www.tensorflow.org/api_docs/python/tf/math/greater)|运算符`>`| -|[tf.math.greater_equal](https://www.tensorflow.org/api_docs/python/tf/math/greater_equal)|运算符`>=`| -|[tf.math.equal](https://www.tensorflow.org/api_docs/python/tf/math/equal)|运算符`==` 或 [paddle.fluid.layers.equal](http://paddlepaddle.org/documentation/docs/zh/1.3/api_cn/layers_cn.html#permalink-7-equal) | -|[tf.math.less](https://www.tensorflow.org/api_docs/python/tf/math/less)|运算符`<` 或 [paddle.fluid.layers.less_than](http://paddlepaddle.org/documentation/docs/zh/1.3/api_cn/layers_cn.html#permalink-11-less_than) | +|[tf.math.less_equal](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/math/less_equal)|运算符`<=`| +|[tf.math.greater](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/math/greater)|运算符`>`| +|[tf.math.greater_equal](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/math/greater_equal)|运算符`>=`| +|[tf.math.equal](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/math/equal)|运算符`==` 或 [paddle.fluid.layers.equal](http://paddlepaddle.org/documentation/docs/zh/1.3/api_cn/layers_cn.html#permalink-7-equal) | +|[tf.math.less](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/math/less)|运算符`<` 或 [paddle.fluid.layers.less_than](http://paddlepaddle.org/documentation/docs/zh/1.3/api_cn/layers_cn.html#permalink-11-less_than) | \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.case.md b/tensorflow2fluid/doc/tf.case.md index 42f9777..92016b9 100644 --- a/tensorflow2fluid/doc/tf.case.md +++ b/tensorflow2fluid/doc/tf.case.md @@ -1,6 +1,6 @@ ## tf.case -### [tf.case](https://www.tensorflow.org/api_docs/python/tf/case) +### [tf.case](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/case) ```python tf.case( @@ -52,4 +52,4 @@ with fluid.layers.control_flow.Switch() as switch: with switch.default(): fluid.layers.tensor.assign(input=lr_0, output=lr) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.clip_by_global_norm.md b/tensorflow2fluid/doc/tf.clip_by_global_norm.md index 411ca33..172c604 100644 --- a/tensorflow2fluid/doc/tf.clip_by_global_norm.md +++ b/tensorflow2fluid/doc/tf.clip_by_global_norm.md @@ -1,6 +1,6 @@ ## tf.clip_by_global_norm -### [tf.clip_by_global_norm](https://www.tensorflow.org/api_docs/python/tf/clip_by_global_norm) +### [tf.clip_by_global_norm](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/clip_by_global_norm) ```python tf.clip_by_global_norm( @@ -46,4 +46,4 @@ with fluid.program_guard(main_program=prog_clip): # 执行裁剪并获取结果 p_g_clip = fluid.clip.append_gradient_clip_ops(p_g_clip) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.clip_by_norm.md b/tensorflow2fluid/doc/tf.clip_by_norm.md index e8ba48a..b7f2754 100644 --- a/tensorflow2fluid/doc/tf.clip_by_norm.md +++ b/tensorflow2fluid/doc/tf.clip_by_norm.md @@ -1,6 +1,6 @@ ## tf.clip_by_norm -### [tf.clip_by_norm](https://www.tensorflow.org/api_docs/python/tf/clip_by_norm) +### [tf.clip_by_norm](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/clip_by_norm) ``` python tf.clip_by_norm( @@ -24,4 +24,4 @@ paddle.fluid.layers.clip_by_norm( #### 计算方式 TensorFlow: 使用参数`axis`指定的轴计算L2范数`l2-norm`,如若`axis`为None,则表示使用整个输入数据的L2范数; -PaddlePaddle:使用整个输入数据的L2范数。 +PaddlePaddle:使用整个输入数据的L2范数。 \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.contrib.layers.flatten.md b/tensorflow2fluid/doc/tf.contrib.layers.flatten.md index fa3c03e..8327a67 100644 --- a/tensorflow2fluid/doc/tf.contrib.layers.flatten.md +++ b/tensorflow2fluid/doc/tf.contrib.layers.flatten.md @@ -1,6 +1,6 @@ ## tf.contrib.layers.flatten -### [tf.contrib.layers.flatten](https://www.tensorflow.org/api_docs/python/tf/contrib/layers/flatten) +### [tf.contrib.layers.flatten](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/contrib/layers/flatten) ```python tf.contrib.layers.flatten( @@ -34,4 +34,4 @@ PaddlePaddle:使用`axis`指定两次合并的维度边界,参考下面示 out = fluid.layers.flatten(x, axis=2) out.shape # [2*3, 4*5] -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.contrib.rnn.GRUCell.md b/tensorflow2fluid/doc/tf.contrib.rnn.GRUCell.md deleted file mode 100644 index 5a4ef95..0000000 --- a/tensorflow2fluid/doc/tf.contrib.rnn.GRUCell.md +++ /dev/null @@ -1,84 +0,0 @@ -## tf.contrib.rnn.GRUCell - -### [tf.contrib.rnn.GRUCell](https://www.tensorflow.org/api_docs/python/tf/nn/rnn_cell/GRUCell) - -```python -tf.contrib.rnn.GRUCell( - num_units, - activation=None, - reuse=None, - kernel_initializer=None, - bias_initializer=None, - name=None, - dtype=None, - **kwargs -) - -``` - -### [paddle.fluid.layers.gru_unit](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#gru-unit) - -```python -paddle.fluid.layers.gru_unit( - input, - hidden, - size, - param_attr=None, - bias_attr=None, - activation='tanh', - gate_activation='sigmoid', - origin_mode=False -) -``` - -### 功能差异 - -#### 实现方式 -TensorFlow:GRU的实现方式见论文[Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation](http://arxiv.org/abs/1406.1078); -PaddlePaddle:GRU有两种实现方式,当设置`origin_mode=False`时,与TensorFlow实现方式一致;当设置`origin_mode=True`时,实现方式则参考论文[Empirical Evaluation of -Gated Recurrent Neural Networks -on Sequence Modeling](https://arxiv.org/pdf/1412.3555.pdf)。 - - -#### 使用方式 -TensorFlow:首先定义`GRUCell`对象,定义对象时只需要指定单元数`num_units`;由于`GRUCell`内部定义了`__call__`方法,因而其对象是可调用对象,直接使用`step_output, cur_state = cell(step_input, last_state)`的形式,可以计算得到当前步的输出与状态; - -PaddlePaddle:提供op形式的调用接口,通常与[paddle.fluid.layers.DynamicRNN](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#dynamicrnn)配合使用,以获取序列中的单步输入。**注意,为了提高`gru_unit`的计算效率,用户在使用该接口时需要遵从如下约定:假设要指定的GRU单元数为`num_units`,则`size`以及`input.shape[-1]`必须为`3*num_units`,`hidden.shape[-1]`为`num_units`,见如下代码示例小节。** - -#### 返回值 -TensorFlow:返回一个二元组,分别是当前时刻的输出值与隐藏状态,实际上输出值与隐藏状态为相同的tensor; -PaddlePaddle:返回一个三元组,即`(hidden_value, reset_hidden_value, gate_value)`。后面两个元素为内部使用,用户可以只关注第一个元素。 - - -### 代码示例 -``` -emb_size = 32 -emb_vocab = 10000 -num_unit_0 = 10 - -data = fluid.layers.data(name='input', shape=[1], dtype='int64', lod_level=1) -embedding = fluid.layers.embedding(input=data, size=[emb_vocab, emb_size], - is_sparse=False) - -# 为了调用gru_unit,输入最后的维度必须为实际单元数的3倍 -emb_fc = layers.fc(embedding, num_unit_0 * 3) - -drnn = fluid.layers.DynamicRNN() -with drnn.block(): - word = drnn.step_input(emb_fc) - - # 指定上一时刻的隐状态,单元数为num_unit_0 - prev_hid0 = drnn.memory(shape=[num_unit_0]) - - # 执行gru_unit计算,num_unit_0 为实际的单元数 - cur_hid0, _, _ = layers.gru_unit(word, prev_hid0, num_unit_0 * 3) - - # 更新隐状态 - drnn.update_memory(prev_hid0, cur_hid0) - - drnn.output(cur_hid0) - -out = drnn() -last = fluid.layers.sequence_last_step(out) - -``` diff --git a/tensorflow2fluid/doc/tf.expand_dims.md b/tensorflow2fluid/doc/tf.expand_dims.md index 7b37dbd..1b284d3 100644 --- a/tensorflow2fluid/doc/tf.expand_dims.md +++ b/tensorflow2fluid/doc/tf.expand_dims.md @@ -1,7 +1,6 @@ - ## tf.expand_dims -### [tf.expand_dims](https://www.tensorflow.org/api_docs/python/tf/expand_dims) +### [tf.expand_dims](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/math/expand_dims) ``` python tf.expand_dims( input, @@ -39,5 +38,4 @@ out = fluid.layers.unsqueeze(t, [-1]) # 输出 tensor out 的 shape 为[1, 1,3, 4] out = fluid.layers.unsqueeze(t, [0, 1]) -``` - +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.image.non_max_suppression.md b/tensorflow2fluid/doc/tf.image.non_max_suppression.md index 40447fe..ec3b328 100644 --- a/tensorflow2fluid/doc/tf.image.non_max_suppression.md +++ b/tensorflow2fluid/doc/tf.image.non_max_suppression.md @@ -1,7 +1,6 @@ - ## tf.image.non_max_suppression -### [tf.image.non_max_suppression](https://www.tensorflow.org/api_docs/python/tf/image/non_max_suppression) +### [tf.image.non_max_suppression](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/image/non_max_suppression) ``` python tf.image.non_max_suppression( boxes, @@ -54,4 +53,4 @@ selected_boxes = fluid.layers.multiclass_nms( nms_top_k=-1, keep_top_k=300, nms_threshold=0.7) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.image.resize_images.md b/tensorflow2fluid/doc/tf.image.resize_images.md index 2e724e3..8e95655 100644 --- a/tensorflow2fluid/doc/tf.image.resize_images.md +++ b/tensorflow2fluid/doc/tf.image.resize_images.md @@ -1,7 +1,6 @@ - ## tf.image.resize_images -### [tf.image.resize_images](https://www.tensorflow.org/api_docs/python/tf/image/resize_images) +### [tf.image.resize_images](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/image/resize_images) ``` python tf.image.resize_images( images, @@ -38,5 +37,4 @@ inputs = fluid.layers.data(dtype='float32', shape=[3, 300, 300], name='inputs') # 输出shape为[3, 400, 500] outputs = fluid.layers.image_reisze(inputs, [400, 500]) -``` - +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.layers.conv2d.md b/tensorflow2fluid/doc/tf.layers.conv2d.md index 3a27a83..e46edb9 100644 --- a/tensorflow2fluid/doc/tf.layers.conv2d.md +++ b/tensorflow2fluid/doc/tf.layers.conv2d.md @@ -1,7 +1,6 @@ - ## tf.layers.conv2d -### [tf.layers.conv2d](https://www.tensorflow.org/api_docs/python/tf/layers/conv2d) +### [tf.layers.conv2d](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/layers/conv2d) ``` python tf.layers.conv2d( inputs, @@ -73,7 +72,7 @@ pad_right = pad_size - pad_left PaddlePaddle:`padding`参数表示在输入图像四周padding的size大小。 #### 参数差异 -TensorFlow:深度可分离卷积使用[tf.layers.separable_conv2d](https://www.tensorflow.org/api_docs/python/tf/layers/separable_conv2d)接口; +TensorFlow:深度可分离卷积使用[tf.layers.separable_conv2d](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/layers/separable_conv2d)接口; PaddlePaddle: 使用`paddle.fluid.layers.conv2d`,可参考 [PaddlePaddle对卷积的说明文档](http://paddlepaddle.org/documentation/docs/zh/1.4/api_guides/low_level/layers/conv.html), 同时也可参考[tf.nn.separable_conv2d](https://github.com/PaddlePaddle/X2Paddle/blob/master/tensorflow2fluid/doc/tf.nn.separable_conv2d.md)中的代码示例。 @@ -85,4 +84,4 @@ PaddlePaddle: 使用`paddle.fluid.layers.conv2d`,可参考 # 卷积核Shape: (5, 3, 4, 4) inputs = paddle.fluid.layers.data(dtype='float32', shape=[3, 200, 200], name='inputs) pad_inputs = paddle.fluid.layers.pad2d(inputs, paddings=[1, 2, 1, 2]) -outputs = paddle.fluid.layers.conv2d(pad_inputs, 5, [4, 4], (1, 1)) +outputs = paddle.fluid.layers.conv2d(pad_inputs, 5, [4, 4], (1, 1)) \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.layers.dense.md b/tensorflow2fluid/doc/tf.layers.dense.md index 3d8a57d..02d0c49 100644 --- a/tensorflow2fluid/doc/tf.layers.dense.md +++ b/tensorflow2fluid/doc/tf.layers.dense.md @@ -1,7 +1,6 @@ - ## tf.layers.dense -### [tf.layers.dense](https://www.tensorflow.org/api_docs/python/tf/layers/dense) +### [tf.layers.dense](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/layers/dense) ``` python tf.layers.dense( inputs, @@ -63,4 +62,4 @@ out = fluid.layers.fc(t, size=6, \ # size=6, num_flatten_dims=2,输出tensor的shape为[2, 3, 6] out = fluid.layers.fc(t, size=6, num_flatten_dims=2) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.losses.mean_and_squared_error.md b/tensorflow2fluid/doc/tf.losses.mean_and_squared_error.md index 915b1a7..56b9701 100644 --- a/tensorflow2fluid/doc/tf.losses.mean_and_squared_error.md +++ b/tensorflow2fluid/doc/tf.losses.mean_and_squared_error.md @@ -1,6 +1,6 @@ ## tf.losses.mean_and_squared_error -### [tf.losses.mean_and_squared_error](https://www.tensorflow.org/api_docs/python/tf/losses/mean_squared_error) +### [tf.losses.mean_and_squared_error](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/losses/mean_squared_error) ``` python tf.losses.mean_squared_error( @@ -25,4 +25,4 @@ paddle.fluid.layers.square_error_cost( #### 计算方式 TensorFlow: 提供`weights`参数,通过传入`weights`参数的shape,可实现不同的加权方式; -PaddlePaddle:不支持加权。 +PaddlePaddle:不支持加权。 \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.losses.sigmoid_cross_entropy.md b/tensorflow2fluid/doc/tf.losses.sigmoid_cross_entropy.md index 7de78de..b6a9bb8 100644 --- a/tensorflow2fluid/doc/tf.losses.sigmoid_cross_entropy.md +++ b/tensorflow2fluid/doc/tf.losses.sigmoid_cross_entropy.md @@ -1,6 +1,6 @@ ## tf.losses.sigmoid_cross_entropy -### [tf.losses.sigmoid_cross_entropy](https://www.tensorflow.org/api_docs/python/tf/losses/sigmoid_cross_entropy) +### [tf.losses.sigmoid_cross_entropy](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/losses/sigmoid_cross_entropy) ```python tf.losses.sigmoid_cross_entropy( @@ -53,4 +53,4 @@ PaddlePaddle:通过设置`normalize`,各样本损失函数会除以除去`ig out = fluid.layers.sigmoid_cross_entropy_with_logits(x, label) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.math.is_finite.md b/tensorflow2fluid/doc/tf.math.is_finite.md index 6d24d21..e299bed 100644 --- a/tensorflow2fluid/doc/tf.math.is_finite.md +++ b/tensorflow2fluid/doc/tf.math.is_finite.md @@ -1,7 +1,6 @@ - ## tf.math.is_finite -### [tf.math.is_finite](https://www.tensorflow.org/api_docs/python/tf/math/is_finite) +### [tf.math.is_finite](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/math/is_finite) ``` python tf.math.is_finite( x, @@ -31,4 +30,4 @@ result = tf.is_finite(inputs) # 输入[2.1, 3.2, 4.5] # 输出True result = fluid.layers.isfinite(inputs) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.math.rsqrt.md b/tensorflow2fluid/doc/tf.math.rsqrt.md index 375f0dd..193cb07 100644 --- a/tensorflow2fluid/doc/tf.math.rsqrt.md +++ b/tensorflow2fluid/doc/tf.math.rsqrt.md @@ -1,6 +1,6 @@ ## tf.math.rsqrt -### [tf.math.rsqrt](https://www.tensorflow.org/api_docs/python/tf/math/rsqrt) +### [tf.math.rsqrt](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/math/rsqrt) ``` python tf.math.rsqrt( x, @@ -23,4 +23,4 @@ inputs = fluid.layers.data(dtype='float32', shape=[1000], name='inputs') # 调用上述自定义函数 result = rsqrt(inputs) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.matmul.md b/tensorflow2fluid/doc/tf.matmul.md index 88849a3..3e5247d 100644 --- a/tensorflow2fluid/doc/tf.matmul.md +++ b/tensorflow2fluid/doc/tf.matmul.md @@ -1,7 +1,6 @@ - ## tf.matmul -### [tf.matmul](https://www.tensorflow.org/api_docs/python/tf/linalg/matmul) +### [tf.matmul](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/linalg/matmul) ``` python tf.matmul( a, @@ -60,4 +59,4 @@ fluid.layers.matmul(x, y) # out: [1] # x: [M], y: [N] fluid.layers.matmul(x, y, True, True) # out: [M, N] -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.nn.avg_pool.md b/tensorflow2fluid/doc/tf.nn.avg_pool.md index 814f42c..b92056c 100644 --- a/tensorflow2fluid/doc/tf.nn.avg_pool.md +++ b/tensorflow2fluid/doc/tf.nn.avg_pool.md @@ -1,6 +1,6 @@ ## tf.nn.avg_pool -### [tf.nn.avg_pool](https://www.tensorflow.org/versions/r1.10/api_docs/python/tf/nn/avg_pool) +### [tf.nn.avg_pool](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/avg_pool) ``` python tf.nn.avg_pool( diff --git a/tensorflow2fluid/doc/tf.nn.bidirectional_dynamic_rnn.md b/tensorflow2fluid/doc/tf.nn.bidirectional_dynamic_rnn.md index c4ebeea..8100a4a 100644 --- a/tensorflow2fluid/doc/tf.nn.bidirectional_dynamic_rnn.md +++ b/tensorflow2fluid/doc/tf.nn.bidirectional_dynamic_rnn.md @@ -1,7 +1,7 @@ ## tf.nn.bidirectional_dynamic_rnn -### [tf.nn.bidirectional_dynamic_rnn](https://www.tensorflow.org/api_docs/python/tf/nn/bidirectional_dynamic_rnn) +### [tf.nn.bidirectional_dynamic_rnn](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/bidirectional_dynamic_rnn) ```python tf.nn.bidirectional_dynamic_rnn( @@ -71,4 +71,4 @@ rev_rev_out = fluid.layers.sequence_reverse(rev_out) # 合并得到最后的输出,其shape为(-1, 32) concat_out = layers.concat([out, rev_rev_out], axis=1) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.nn.conv2d.md b/tensorflow2fluid/doc/tf.nn.conv2d.md index 610f630..e01a61f 100644 --- a/tensorflow2fluid/doc/tf.nn.conv2d.md +++ b/tensorflow2fluid/doc/tf.nn.conv2d.md @@ -1,6 +1,6 @@ ## tf.nn.conv2d -### [tf.nn.conv2d](https://www.tensorflow.org/api_docs/python/tf/nn/conv2d) +### [tf.nn.conv2d](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/conv2d) ```python tf.nn.conv2d( @@ -48,4 +48,4 @@ create_kernel = fluid.layers.create_parameters(shape=[5, 3, 2, 2], dtype='float3 # PaddlePaddle中可通过相同的参数命名引用同一个参数变量 # 通过指定卷积核参数名(param_attr)为'kernel',引用了create_kernel result = fluid.layers.conv2d(inputs, 5, [2, 2], param_attr='kernel') -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.nn.conv2d_transpose.md b/tensorflow2fluid/doc/tf.nn.conv2d_transpose.md index ceca833..f47931c 100644 --- a/tensorflow2fluid/doc/tf.nn.conv2d_transpose.md +++ b/tensorflow2fluid/doc/tf.nn.conv2d_transpose.md @@ -1,7 +1,6 @@ - ## tf.nn.conv2d_transpose -### [tf.nn.conv2d_transpose](https://www.tensorflow.org/api_docs/python/tf/nn/conv2d_transpose) +### [tf.nn.conv2d_transpose](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/conv2d_transpose) ``` python tf.nn.conv2d_transpose( value, @@ -93,4 +92,4 @@ inputs = fluid.layers.data(dtype='float32', shape=[3, 20, 20], name='inputs) outputs = fluid.layers.conv2d_transpose(pad_inputs, 3, filter_size=[5, 5], padding=[1, 1], stride=[2, 2], bias_attr=False) # 裁剪后结果即为与TensorFlow一致 -outputs = fluid.layers.crop(outputs, shape=[-1, 3, 40, 40]) +outputs = fluid.layers.crop(outputs, shape=[-1, 3, 40, 40]) \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.nn.conv3d_transpose.md b/tensorflow2fluid/doc/tf.nn.conv3d_transpose.md index e27025b..4470806 100644 --- a/tensorflow2fluid/doc/tf.nn.conv3d_transpose.md +++ b/tensorflow2fluid/doc/tf.nn.conv3d_transpose.md @@ -1,7 +1,6 @@ - ## tf.nn.conv3d_transpose -### [tf.nn.conv3d_transpose](https://www.tensorflow.org/api_docs/python/tf/nn/conv3d_transpose) +### [tf.nn.conv3d_transpose](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/conv3d_transpose) ``` python tf.nn.conv3d_transpose( value, @@ -93,4 +92,4 @@ inputs = fluid.layers.data(dtype='float32', shape=[3, 5, 20, 40], name='inputs) outputs = fluid.layers.conv3d(inputs, 7, filter_size=(2, 4, 5), stride=(1, 2, 2), padding=(0, 1, 1), bias_attr=False) # 裁剪后结果即为与TensorFlow一致 -outputs = fluid.layers.crop(outputs, shape=[-1, 7, 5, 40, 80]) +outputs = fluid.layers.crop(outputs, shape=[-1, 7, 5, 40, 80]) \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.nn.depthwise_conv2d.md b/tensorflow2fluid/doc/tf.nn.depthwise_conv2d.md index cad451f..e6c1c1f 100644 --- a/tensorflow2fluid/doc/tf.nn.depthwise_conv2d.md +++ b/tensorflow2fluid/doc/tf.nn.depthwise_conv2d.md @@ -1,6 +1,6 @@ ## tf.nn.depthwise_conv2d -### [tf.nn.depthwise_conv2d](https://www.tensorflow.org/api_docs/python/tf/nn/depthwise_conv2d) +### [tf.nn.depthwise_conv2d](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/depthwise_conv2d) ```python tf.nn.depthwise_conv2d( @@ -84,4 +84,4 @@ inputs = fluid.layers.data(dtype='float32', shape=[3, 20, 20], name='inputs') inputs = fluid.layers.pad2d(inputs, paddings=[1, 2, 1, 2]) #输出shape:[-1, 3, 20, 20] result = fluid.layers.conv2d(inputs, 3, filter_size=[4, 4], groups=3, bias_attr=False) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.nn.dropout.md b/tensorflow2fluid/doc/tf.nn.dropout.md index d77a1f4..9d43c2f 100644 --- a/tensorflow2fluid/doc/tf.nn.dropout.md +++ b/tensorflow2fluid/doc/tf.nn.dropout.md @@ -1,7 +1,6 @@ - ## tf.dropout -### [tf.nn.dropout](https://www.tensorflow.org/api_docs/python/tf/nn/dropout) +### [tf.nn.dropout](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/dropout) ``` python tf.nn.dropout( x, @@ -47,4 +46,4 @@ out = fluid.layers.dropout(t, dropout_prob=0.2, dropout_implementation="upscale_ # inference 时关闭dropout inference_program = fluid.default_main_program().clone(for_test=True) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.nn.dynamic_rnn.md b/tensorflow2fluid/doc/tf.nn.dynamic_rnn.md index 202aebc..d47bfbb 100644 --- a/tensorflow2fluid/doc/tf.nn.dynamic_rnn.md +++ b/tensorflow2fluid/doc/tf.nn.dynamic_rnn.md @@ -1,6 +1,6 @@ ## tf.nn.dynamic_rnn -### [tf.nn.dynamic_rnn](https://www.tensorflow.org/api_docs/python/tf/nn/dynamic_rnn) +### [tf.nn.dynamic_rnn](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/dynamic_rnn) ``` python tf.nn.dynamic_rnn( cell, @@ -75,4 +75,4 @@ state = fluid.layers.sequence_last_step(outputs) 为了简化用户定义动态RNN的过程,paddle有如下op可供选择: - [paddle.fluid.layers.dynamic_lstm](http://www.paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#dynamic-lstm):相当于 `tf.nn.dynamic_rnn`结合`tf.nn.rnn_cell.LSTMCell` -- [paddle.fluid.layers.dynamic_gru](http://www.paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#dynamic-gru):相当于`tf.nn.dynamic_rnn`结合`tf.nn.rnn_cell.GRUCell` +- [paddle.fluid.layers.dynamic_gru](http://www.paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#dynamic-gru):相当于`tf.nn.dynamic_rnn`结合`tf.nn.rnn_cell.GRUCell` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.nn.l2_normalize.md b/tensorflow2fluid/doc/tf.nn.l2_normalize.md index 27f4692..387dd8b 100644 --- a/tensorflow2fluid/doc/tf.nn.l2_normalize.md +++ b/tensorflow2fluid/doc/tf.nn.l2_normalize.md @@ -1,7 +1,6 @@ - ## tf.nn.l2_normalize -### [tf.nn.l2_normalize](https://www.tensorflow.org/api_docs/python/tf/math/l2_normalize) +### [tf.nn.l2_normalize](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/math/l2_normalize) ```python tf.math.l2_normalize( @@ -38,4 +37,4 @@ PaddlePaddle:计算方式为`output = x / sqrt(sum(x^2) + epsilon))`。 # out同样是shape[3,2]的张量,axis设置为1,表示将x中每个行向量做归一化 out = fluid.layers.l2_normalize(x, axis=1) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.nn.lrn.md b/tensorflow2fluid/doc/tf.nn.lrn.md index d903ea4..06522e9 100644 --- a/tensorflow2fluid/doc/tf.nn.lrn.md +++ b/tensorflow2fluid/doc/tf.nn.lrn.md @@ -1,7 +1,6 @@ - ## tf.nn.lrn -### [tf.nn.lrn](https://www.tensorflow.org/api_docs/python/tf/nn/local_response_normalization) +### [tf.nn.lrn](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/local_response_normalization) ```python tf.nn.local_response_normalization( @@ -38,4 +37,4 @@ $$output(i,x,y)=input(i,x,y)/(k+\alpha\sum_{j=max(0,i-\frac{n}{2})}^{min(C,i+\fr #### 输入格式 TensorFlow: 默认输入`NHWC`格式数据; -PaddlePaddle: 默认输入`NCHW`格式数据, +PaddlePaddle: 默认输入`NCHW`格式数据, \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.nn.max_pool.md b/tensorflow2fluid/doc/tf.nn.max_pool.md index 24cd612..629a7a7 100644 --- a/tensorflow2fluid/doc/tf.nn.max_pool.md +++ b/tensorflow2fluid/doc/tf.nn.max_pool.md @@ -1,6 +1,6 @@ ## tf.nn.max_pool -### [tf.nn.max_pool](https://www.tensorflow.org/api_docs/python/tf/nn/max_pool) +### [tf.nn.max_pool](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/max_pool) ``` python tf.nn.max_pool( @@ -51,4 +51,4 @@ inputs = fluid.layers.data(dtype='float32', shape=[3, 300, 300], name='inputs') # 在最右、最下进行padding pad_res = fluid.layers.pad2d(inputs, padding=[0, 1, 0, 1]) conv_res = fluid.layers.pool2d(pad_res, pool_size=3, pool_type='max', pool_stride=2) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.nn.reduce_logsumexp.md b/tensorflow2fluid/doc/tf.nn.reduce_logsumexp.md index 9ff361e..b40fc39 100644 --- a/tensorflow2fluid/doc/tf.nn.reduce_logsumexp.md +++ b/tensorflow2fluid/doc/tf.nn.reduce_logsumexp.md @@ -1,6 +1,6 @@ ## tf.math.reduce_logsumexp -### [tf.math.reduce_logsumexp](https://www.tensorflow.org/api_docs/python/tf/math/reduce_logsumexp) +### [tf.math.reduce_logsumexp](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/math/reduce_logsumexp) ``` python tf.math.log_softmax( logits, @@ -26,4 +26,4 @@ inputs = fluid.layers.data(dtype='float32', shape=[1000], name='inputs') # 调用上述自定义函数 result = reduce_logsumexp(inputs) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.nn.rnn_cell.LSTMCell.md b/tensorflow2fluid/doc/tf.nn.rnn_cell.LSTMCell.md index 29391f1..e4ccbdd 100644 --- a/tensorflow2fluid/doc/tf.nn.rnn_cell.LSTMCell.md +++ b/tensorflow2fluid/doc/tf.nn.rnn_cell.LSTMCell.md @@ -1,6 +1,6 @@ ## tf.nn.rnn_cell.LSTMCell -### [tf.nn.rnn_cell.LSTMCell](https://www.tensorflow.org/api_docs/python/tf/nn/rnn_cell/LSTMCell) +### [tf.nn.rnn_cell.LSTMCell](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/rnn_cell/LSTMCell) ```python tf.nn.rnn_cell.LSTMCell( @@ -85,4 +85,4 @@ out = drnn() # 获取最后时刻的输出 last = fluid.layers.sequence_last(out) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.nn.rnn_cell.MultiRNNCell.md b/tensorflow2fluid/doc/tf.nn.rnn_cell.MultiRNNCell.md index cb0f231..1686414 100644 --- a/tensorflow2fluid/doc/tf.nn.rnn_cell.MultiRNNCell.md +++ b/tensorflow2fluid/doc/tf.nn.rnn_cell.MultiRNNCell.md @@ -1,9 +1,9 @@ ## tf.nn.rnn_cell.MultiRNNCell -### [tf.nn.rnn_cell.MultiRNNCell](https://www.tensorflow.org/api_docs/python/tf/nn/rnn_cell/MultiRNNCell) +### [tf.nn.rnn_cell.MultiRNNCell](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/rnn_cell/MultiRNNCell) ```python -tf.nn.rnn_cell.MultiRNNCell( +__init__( cells, state_is_tuple=True ) diff --git a/tensorflow2fluid/doc/tf.nn.separable_conv2d.md b/tensorflow2fluid/doc/tf.nn.separable_conv2d.md index e89dda3..a9814e5 100644 --- a/tensorflow2fluid/doc/tf.nn.separable_conv2d.md +++ b/tensorflow2fluid/doc/tf.nn.separable_conv2d.md @@ -1,6 +1,6 @@ ## tf.nn.separable_conv2d -### [tf.nn.separable_conv2d](https://www.tensorflow.org/api_docs/python/tf/nn/separable_conv2d) +### [tf.nn.separable_conv2d](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/separable_conv2d) ``` python tf.nn.separable_conv2d( input, @@ -30,4 +30,4 @@ depthwise_result = fluid.layers.conv2d(input, 3, filter_size=[4, 4], pointwise_result = fluid.layers.conv2d(depthwise_result, filter_size=[1, 1], stride=[1, 1], bias_attr=False) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.nn.softmax_cross_entropy_with_logits.md b/tensorflow2fluid/doc/tf.nn.softmax_cross_entropy_with_logits.md index 35968e4..06f1b10 100644 --- a/tensorflow2fluid/doc/tf.nn.softmax_cross_entropy_with_logits.md +++ b/tensorflow2fluid/doc/tf.nn.softmax_cross_entropy_with_logits.md @@ -1,6 +1,6 @@ ## tf.nn.softmax_cross_entropy_with_logits -### [tf.nn.rnn_cell.MultiRNNCell](https://www.tensorflow.org/api_docs/python/tf/nn/softmax_cross_entropy_with_logits) +### [tf.nn.rnn_cell.MultiRNNCell](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/softmax_cross_entropy_with_logits) ```python tf.nn.softmax_cross_entropy_with_logits( @@ -20,7 +20,8 @@ paddle.fluid.layers.softmax_with_cross_entropy( soft_label=False, ignore_index=-100, numeric_stable_mode=False, - return_softmax=False + return_softmax=False, + axis=-1 ) ``` diff --git a/tensorflow2fluid/doc/tf.nn.top_k.md b/tensorflow2fluid/doc/tf.nn.top_k.md index 1e05dcf..327d8d7 100644 --- a/tensorflow2fluid/doc/tf.nn.top_k.md +++ b/tensorflow2fluid/doc/tf.nn.top_k.md @@ -1,7 +1,6 @@ - ## tf.nn.top_k -### [tf.nn.top_k](https://www.tensorflow.org/api_docs/python/tf/nn/top_k) +### [tf.nn.top_k](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/nn/top_k) ``` python tf.math.top_k( input, @@ -32,4 +31,4 @@ PaddlePaddle: 对返回的top-k tensor进行降序排序;`k`没有默认值, # 当k=2时,输出 tensor out 为[[6,3], [8,3]],index为[[1,2],[2,0]] out, index = fluid.layers.topk(t, k=1) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.one_hot.md b/tensorflow2fluid/doc/tf.one_hot.md index 1ccc182..f2c56a0 100644 --- a/tensorflow2fluid/doc/tf.one_hot.md +++ b/tensorflow2fluid/doc/tf.one_hot.md @@ -1,7 +1,6 @@ - ## tf.one_hot -### [tf.one_hot](https://www.tensorflow.org/api_docs/python/tf/one_hot) +### [tf.one_hot](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/one_hot) ``` python tf.one_hot( indices, @@ -38,4 +37,4 @@ PaddlePaddle:无对应配置选项,即为默认的`1`和`0`。 # depth 为3时,输出 tensor out 为[[0, 1, 0], [0, 0, 1]] out = fluid.layers.one_hot(t, 3) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.pad.md b/tensorflow2fluid/doc/tf.pad.md index dddcb77..71cc774 100644 --- a/tensorflow2fluid/doc/tf.pad.md +++ b/tensorflow2fluid/doc/tf.pad.md @@ -1,7 +1,6 @@ - ## tf.pad -### [tf.pad](https://www.tensorflow.org/api_docs/python/tf/pad) +### [tf.pad](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/pad) ``` python tf.pad( tensor, @@ -34,4 +33,4 @@ PaddlePaddle:目前仅支持采用常量进行padding;指定padding长度时 # 第0维前面padding长度为0,后面padding长度为1;第1维前面padding长度为1,后面padding长度为2 out = fluid.layers.pad(t, paddings=[0,1,1,2]) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.placeholder.md b/tensorflow2fluid/doc/tf.placeholder.md index c0e9d5c..a17015d 100644 --- a/tensorflow2fluid/doc/tf.placeholder.md +++ b/tensorflow2fluid/doc/tf.placeholder.md @@ -1,7 +1,6 @@ - ## tf.placeholder -### [tf.placeholder](https://www.tensorflow.org/api_docs/python/tf/placeholder) +### [tf.placeholder](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/placeholder) ``` python tf.placeholder( dtype, @@ -36,4 +35,4 @@ out = fluid.layers.data('out', shape=[3, 4], dtype='float32') # 创建输入型tensor out,其shape为[3, -1, 4], 数据类型为float32 out = fluid.layers.data('out', shape=[3, -1, 4], append_batch_size=False, dtype='float32') -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.pow.md b/tensorflow2fluid/doc/tf.pow.md index 5fa4a03..afd39b0 100644 --- a/tensorflow2fluid/doc/tf.pow.md +++ b/tensorflow2fluid/doc/tf.pow.md @@ -1,6 +1,6 @@ ## tf.pow -### [tf.pow](https://www.tensorflow.org/api_docs/python/tf/math/pow) +### [tf.pow](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/math/pow) ```python tf.math.pow( @@ -33,4 +33,4 @@ PaddlePaddle:`x`为tensor,`factor`为浮点数,返回值为`x`每个元素 # x为张量 [2, 3] out = fluid.layers.pow(x, 2.0) # [4,9] -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.print.md b/tensorflow2fluid/doc/tf.print.md index a4651ac..8989fa7 100644 --- a/tensorflow2fluid/doc/tf.print.md +++ b/tensorflow2fluid/doc/tf.print.md @@ -1,6 +1,6 @@ ## tf.print -### [tf.print](https://www.tensorflow.org/api_docs/python/tf/print) +### [tf.print](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/print) ```python tf.print( @@ -47,4 +47,4 @@ PaddlePaddle:通过设置`print_phase`,可以控制是否打印`input`的梯 # 打印input的内容,如果有梯度的话也将打印梯度 print(input, message="content of input") -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.reshape.md b/tensorflow2fluid/doc/tf.reshape.md index a8f4988..e7e0dd7 100644 --- a/tensorflow2fluid/doc/tf.reshape.md +++ b/tensorflow2fluid/doc/tf.reshape.md @@ -1,7 +1,6 @@ - ## tf.reshape -### [tf.reshape](https://www.tensorflow.org/api_docs/python/tf/reshape) +### [tf.reshape](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/reshape) ``` python tf.reshape( tensor, @@ -37,5 +36,4 @@ out = fluid.layers.reshape(t, [-1, 6]) # 输出 tensor out 的 shape 为[3, 2, 2] out = fluid.layers.reshape(t, [0, 2, 2]) -``` - +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.reverse_sequence.md b/tensorflow2fluid/doc/tf.reverse_sequence.md index d890c24..084fe12 100644 --- a/tensorflow2fluid/doc/tf.reverse_sequence.md +++ b/tensorflow2fluid/doc/tf.reverse_sequence.md @@ -1,6 +1,6 @@ ## tf.reverse_sequence -### [tf.reverse_sequence](https://www.tensorflow.org/api_docs/python/tf/reverse_sequence) +### [tf.reverse_sequence](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/reverse_sequence) ```python tf.reverse_sequence( @@ -44,4 +44,4 @@ PaddlePaddle:由于`LoDTensor`本身已经携带序列信息,因而不需要 # out[0:2, 6] = x[2:0:-1, 6] # out[2:5, 6] = x[5:2:-1, 6] out = fluid.layers.sequence_reverse(x) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.scatter_update.md b/tensorflow2fluid/doc/tf.scatter_update.md index 3bdb29c..7223986 100644 --- a/tensorflow2fluid/doc/tf.scatter_update.md +++ b/tensorflow2fluid/doc/tf.scatter_update.md @@ -1,6 +1,6 @@ ## tf.scatter_update -### [tf.scatter_update](https://www.tensorflow.org/api_docs/python/tf/scatter_update) +### [tf.scatter_update](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/scatter_update) ```python tf.scatter_update( @@ -19,7 +19,8 @@ paddle.fluid.layers.scatter( input, index, updates, - name=None + name=None, + overwrite=True ) ``` @@ -32,7 +33,7 @@ PaddlePaddle:`index`只支持1-d Variable。 #### 其他 Tensorflow:`updates`支持numpy-style broadcasting; -PaddlePaddle:`updates`要求其rank与`input`相同,同时`updates.shape[0]`等于`index.shape[0]`。 +PaddlePaddle:`updates`要求其rank与`input`相同,同时`updates.shape[0]`等于`index.shape[0]`。此外`overwrite`参数提供了当存在重复index时,两种不同的梯度更新策略。 ### 代码示例 ``` diff --git a/tensorflow2fluid/doc/tf.slice.md b/tensorflow2fluid/doc/tf.slice.md index 0e5b631..04e1dd1 100644 --- a/tensorflow2fluid/doc/tf.slice.md +++ b/tensorflow2fluid/doc/tf.slice.md @@ -1,7 +1,6 @@ - ## tf.slice -### [tf.slice](https://www.tensorflow.org/api_docs/python/tf/slice) +### [tf.slice](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/slice) ``` python tf.slice( input_, @@ -40,4 +39,4 @@ out = fluid.layers.slice(t, axes=[0,1], starts=[0,1], ends=[2,3]) # 输出 tensor out 为[[1,2],[5,6],[9,10]] out = fluid.layers.slice(t, axes=[1], starts=[1], ends=[3]) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.split.md b/tensorflow2fluid/doc/tf.split.md index ad62e38..c0b7b94 100644 --- a/tensorflow2fluid/doc/tf.split.md +++ b/tensorflow2fluid/doc/tf.split.md @@ -1,6 +1,6 @@ ## tf.split -### [tf.split](https://www.tensorflow.org/api_docs/python/tf/split) +### [tf.split](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/split) ```python tf.split( @@ -39,4 +39,4 @@ x0.shape # [3, 3, 5] x1.shape # [3, 3, 5] x2.shape # [3, 3, 5] -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.squared_difference.md b/tensorflow2fluid/doc/tf.squared_difference.md index 54d9290..5218257 100644 --- a/tensorflow2fluid/doc/tf.squared_difference.md +++ b/tensorflow2fluid/doc/tf.squared_difference.md @@ -1,6 +1,6 @@ ## tf.squared_difference -### [tf.squared_diffenrece](https://www.tensorflow.org/api_docs/python/tf/math/squared_difference) +### [tf.squared_diffenrece](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/math/squared_difference) ``` python tf.math.squared_difference( x, @@ -24,4 +24,4 @@ input_x = fluid.layers.data(dtype='float32', shape=[1000], name='input_x') input_y = fluid.layers.data(dtype='float32', shape=[1000], name='input_y') # 调用上述自定义函数 result = squared_difference(input_x, input_y) -``` +``` \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.stop_gradient.md b/tensorflow2fluid/doc/tf.stop_gradient.md index 2bfa214..1f7397c 100644 --- a/tensorflow2fluid/doc/tf.stop_gradient.md +++ b/tensorflow2fluid/doc/tf.stop_gradient.md @@ -1,7 +1,6 @@ - ## tf.stop_gradient -### [tf.stop_gradient](https://www.tensorflow.org/api_docs/python/tf/stop_gradient) +### [tf.stop_gradient](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/stop_gradient) ``` python tf.stop_gradient( input, @@ -15,4 +14,4 @@ TensorFlow中,使用`stop_gradient`表示该tensor不需要进行bp。而在Pa ## 代码示例 ```python # 将tensor t设置成不需要bp -t.stop_gradient = True +t.stop_gradient = True \ No newline at end of file diff --git a/tensorflow2fluid/doc/tf.while_loop.md b/tensorflow2fluid/doc/tf.while_loop.md index 6e2d842..f734fda 100644 --- a/tensorflow2fluid/doc/tf.while_loop.md +++ b/tensorflow2fluid/doc/tf.while_loop.md @@ -1,6 +1,6 @@ ## tf.while_loop -### [tf.while_loop](https://www.tensorflow.org/api_docs/python/tf/while_loop) +### [tf.while_loop](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/while_loop) ```python tf.while_loop( @@ -53,4 +53,4 @@ with while_op.block(): i = layers.increment(x=i, in_place=True) # 更新条件状态 layers.less_than(x=i, y=limit, cond=cond) -``` +``` \ No newline at end of file -- GitLab