未验证 提交 f2364d84 编写于 作者: W wangchaochaohu 提交者: GitHub

fix cn doc test=develop (#1490)

上级 678845bd
......@@ -23,13 +23,13 @@ equal
import paddle.fluid as fluid
import numpy as np
out_cond =fluid.layers.data(name="input1", shape=[2], dtype='bool', append_batch_size=False)
out_cond =fluid.data(name="input1", shape=[2], dtype='bool')
label = fluid.layers.assign(np.array([3, 3], dtype="int32"))
limit = fluid.layers.assign(np.array([3, 2], dtype="int32"))
label_cond = fluid.layers.assign(np.array([1, 2], dtype="int32"))
out1 = fluid.layers.equal(x=label,y=limit) #out1=[True, False]
out2 = fluid.layers.equal(x=label_cond,y=limit, out=out_cond) #out2=[False, True] out_cond=[False, True]
out2 = fluid.layers.equal(x=label_cond,y=limit, cond=out_cond) #out2=[False, True] out_cond=[False, True]
......
......@@ -26,7 +26,7 @@ reduce_max
# [[0.2, 0.3, 0.5, 0.9]
# [0.1, 0.2, 0.6, 0.7]]
# 接下来的示例中,我们在每处函数调用后面都标注出了它的结果张量。
x = fluid.layers.data(name='x', shape=[2, 4], dtype='float32')
x = fluid.data(name='x', shape=[2, 4], dtype='float32')
fluid.layers.reduce_max(x) # [0.9]
fluid.layers.reduce_max(x, dim=0) # [0.2, 0.3, 0.6, 0.9]
fluid.layers.reduce_max(x, dim=-1) # [0.9, 0.7]
......@@ -36,7 +36,7 @@ reduce_max
# [[[1.0, 2.0], [3.0, 4.0]],
# [[5.0, 6.0], [7.0, 8.0]]]
# 接下来的示例中,我们在每处函数调用后面都标注出了它的结果张量。
y = fluid.layers.data(name='y', shape=[2, 2, 2], dtype='float32')
y = fluid.data(name='y', shape=[2, 2, 2], dtype='float32')
fluid.layers.reduce_max(y, dim=[1, 2]) # [4.0, 8.0]
fluid.layers.reduce_max(y, dim=[0, 1]) # [7.0, 8.0]
......
......@@ -26,7 +26,7 @@ reduce_mean
# [[0.2, 0.3, 0.5, 0.9]
# [0.1, 0.2, 0.6, 0.7]]
# 接下来的示例中,我们在每处函数调用后面都标注出了它的结果张量。
x = fluid.layers.data(name='x', shape=[2, 4], dtype='float32')
x = fluid.data(name='x', shape=[2, 4], dtype='float32')
fluid.layers.reduce_mean(x) # [0.4375]
fluid.layers.reduce_mean(x, dim=0) # [0.15, 0.25, 0.55, 0.8]
fluid.layers.reduce_mean(x, dim=-1) # [0.475, 0.4]
......@@ -36,7 +36,7 @@ reduce_mean
# [[[1.0, 2.0], [3.0, 4.0]],
# [[5.0, 6.0], [7.0, 8.0]]]
# 接下来的示例中,我们在每处函数调用后面都标注出了它的结果张量。。
y = fluid.layers.data(name='y', shape=[2, 2, 2], dtype='float32')
y = fluid.data(name='y', shape=[2, 2, 2], dtype='float32')
fluid.layers.reduce_mean(y, dim=[1, 2]) # [2.5, 6.5]
fluid.layers.reduce_mean(y, dim=[0, 1]) # [4.0, 5.0]
......
......@@ -26,7 +26,7 @@ reduce_min
# [[0.2, 0.3, 0.5, 0.9]
# [0.1, 0.2, 0.6, 0.7]]
# 接下来的示例中,我们在每处函数调用后面都标注出了它的结果张量。
x = fluid.layers.data(name='x', shape=[2, 4], dtype='float32')
x = fluid.data(name='x', shape=[2, 4], dtype='float32')
fluid.layers.reduce_min(x) # [0.1]
fluid.layers.reduce_min(x, dim=0) # [0.1, 0.2, 0.5, 0.7]
fluid.layers.reduce_min(x, dim=-1) # [0.2, 0.1]
......@@ -36,7 +36,7 @@ reduce_min
# [[[1.0, 2.0], [3.0, 4.0]],
# [[5.0, 6.0], [7.0, 8.0]]]
# 接下来的示例中,我们在每处函数调用后面都标注出了它的结果张量。
y = fluid.layers.data(name='y', shape=[2, 2, 2], dtype='float32')
y = fluid.data(name='y', shape=[2, 2, 2], dtype='float32')
fluid.layers.reduce_min(y, dim=[1, 2]) # [1.0, 5.0]
fluid.layers.reduce_min(y, dim=[0, 1]) # [1.0, 2.0]
......
......@@ -26,7 +26,7 @@ reduce_prod
# [[0.2, 0.3, 0.5, 0.9]
# [0.1, 0.2, 0.6, 0.7]]
# 接下来的示例中,我们在每处函数调用后面都标注出了它的结果张量。
x = fluid.layers.data(name='x', shape=[2, 4], dtype='float32')
x = fluid.data(name='x', shape=[2, 4], dtype='float32')
fluid.layers.reduce_prod(x) # [0.0002268]
fluid.layers.reduce_prod(x, dim=0) # [0.02, 0.06, 0.3, 0.63]
fluid.layers.reduce_prod(x, dim=-1) # [0.027, 0.0084]
......@@ -37,7 +37,7 @@ reduce_prod
# [[[1.0, 2.0], [3.0, 4.0]],
# [[5.0, 6.0], [7.0, 8.0]]]
# 接下来的示例中,我们在每处函数调用后面都标注出了它的结果张量。
y = fluid.layers.data(name='y', shape=[2, 2, 2], dtype='float32')
y = fluid.data(name='y', shape=[2, 2, 2], dtype='float32')
fluid.layers.reduce_prod(y, dim=[1, 2]) # [24.0, 1680.0]
fluid.layers.reduce_prod(y, dim=[0, 1]) # [105.0, 384.0]
......
......@@ -26,7 +26,7 @@ reduce_sum
# [[0.2, 0.3, 0.5, 0.9]
# [0.1, 0.2, 0.6, 0.7]]
# 接下来的示例中,我们在每处函数调用后面都标注出了它的结果张量。
x = fluid.layers.data(name='x', shape=[2, 4], dtype='float32')
x = fluid.data(name='x', shape=[2, 4], dtype='float32')
fluid.layers.reduce_sum(x) # [3.5]
fluid.layers.reduce_sum(x, dim=0) # [0.3, 0.5, 1.1, 1.6]
fluid.layers.reduce_sum(x, dim=-1) # [1.9, 1.6]
......@@ -36,7 +36,7 @@ reduce_sum
# [[[1, 2], [3, 4]],
# [[5, 6], [7, 8]]]
# 接下来的示例中,我们在每处函数调用后面都标注出了它的结果张量。
y = fluid.layers.data(name='y', shape=[2, 2, 2], dtype='float32')
y = fluid.data(name='y', shape=[2, 2, 2], dtype='float32')
fluid.layers.reduce_sum(y, dim=[1, 2]) # [10, 26]
fluid.layers.reduce_sum(y, dim=[0, 1]) # [16, 20]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册