未验证 提交 7459c1c2 编写于 作者: W wawltor 提交者: GitHub

Fix the doc example for some ops

Fix the doc examples for those apis
上级 203973b0
......@@ -48,7 +48,7 @@ deformable_roi_pooling
.. code-block:: python
#position_sensitiveFalse
#position_sensitive=False
import paddle.fluid as fluid
input = fluid.data(name="input",
......@@ -74,7 +74,7 @@ deformable_roi_pooling
trans_std=0.1,
position_sensitive=False)
#position_sensitiveTrue
#position_sensitive=True
import paddle.fluid as fluid
input = fluid.data(name="input",
......
......@@ -107,7 +107,7 @@ elementwise_add
"y": np.random.randint(1, 5, size=[5]).astype('float32')
}
x = fluid.layers.data(name="x", shape=[2,3,4,5], dtype='float32')
y = fluid.layers.data(name="y", shape=[3,4], dtype='float32')
y = fluid.layers.data(name="y", shape=[5], dtype='float32')
# z = x + y
z = fluid.layers.elementwise_add(x, y, axis=3)
place = fluid.CPUPlace()
......
......@@ -107,7 +107,7 @@ elementwise_div
"y": np.random.randint(1, 5, size=[5]).astype('float32')
}
x = fluid.layers.data(name="x", shape=[2,3,4,5], dtype='float32')
y = fluid.layers.data(name="y", shape=[3,4], dtype='float32')
y = fluid.layers.data(name="y", shape=[5], dtype='float32')
z = fluid.layers.elementwise_div(x, y, axis=3)
# z = x / y
place = fluid.CPUPlace()
......
......@@ -107,7 +107,7 @@ elementwise_mul
"y": np.random.randint(1, 5, size=[5]).astype('float32')
}
x = fluid.layers.data(name="x", shape=[2,3,4,5], dtype='float32')
y = fluid.layers.data(name="y", shape=[3,4], dtype='float32')
y = fluid.layers.data(name="y", shape=[5], dtype='float32')
z = fluid.layers.elementwise_mul(x, y, axis=3)
# z = x * y
place = fluid.CPUPlace()
......
......@@ -107,7 +107,7 @@ elementwise_sub
"y": np.random.randint(1, 5, size=[5]).astype('float32')
}
x = fluid.layers.data(name="x", shape=[2,3,4,5], dtype='float32')
y = fluid.layers.data(name="y", shape=[3,4], dtype='float32')
y = fluid.layers.data(name="y", shape=[5], dtype='float32')
z = fluid.layers.elementwise_sub(x, y, axis=3)
# z = x - y
place = fluid.CPUPlace()
......
......@@ -62,7 +62,7 @@ scale
import numpy as np
inputs = fluid.layers.data(name="x", shape=[2, 3], dtype='float32')
scale = fluid.layers.data(name="scale", shape=[1], dtype='float32'
scale = fluid.layers.data(name="scale", shape=[1], dtype='float32',
append_batch_size=False)
output = fluid.layers.scale(inputs, scale = scale, bias = 1.0)
......
......@@ -27,7 +27,7 @@ unique为 ``x`` 返回一个unique张量和一个指向该unique张量的索引
import numpy as np
import paddle.fluid as fluid
x = fluid.assign(np.array([2, 3, 3, 1, 5, 3], dtype='int32'))
x = fluid.layers.assign(np.array([2, 3, 3, 1, 5, 3], dtype='int32'))
out, index = fluid.layers.unique(x) # out is [2, 3, 1, 5]; index is [0, 1, 1, 2, 3, 1]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册