提交 5da81429 编写于 作者: D danleifeng 提交者: gongweibao

fix code example of elementwise op in en_doc (#20242)

fix code example of elementwise op in en_doc
上级 5ebf4078
...@@ -247,13 +247,13 @@ paddle.fluid.layers.unique_with_counts (ArgSpec(args=['x', 'dtype'], varargs=Non ...@@ -247,13 +247,13 @@ paddle.fluid.layers.unique_with_counts (ArgSpec(args=['x', 'dtype'], varargs=Non
paddle.fluid.layers.expand (ArgSpec(args=['x', 'expand_times', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '7b97042c3ba55fb5fec6a06308523b73')) paddle.fluid.layers.expand (ArgSpec(args=['x', 'expand_times', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '7b97042c3ba55fb5fec6a06308523b73'))
paddle.fluid.layers.sequence_concat (ArgSpec(args=['input', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'f47f9d207ac60b6f294087bcb1b64ae8')) paddle.fluid.layers.sequence_concat (ArgSpec(args=['input', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'f47f9d207ac60b6f294087bcb1b64ae8'))
paddle.fluid.layers.scale (ArgSpec(args=['x', 'scale', 'bias', 'bias_after_scale', 'act', 'name'], varargs=None, keywords=None, defaults=(1.0, 0.0, True, None, None)), ('document', '463e4713806e5adaa4d20a41e2218453')) paddle.fluid.layers.scale (ArgSpec(args=['x', 'scale', 'bias', 'bias_after_scale', 'act', 'name'], varargs=None, keywords=None, defaults=(1.0, 0.0, True, None, None)), ('document', '463e4713806e5adaa4d20a41e2218453'))
paddle.fluid.layers.elementwise_add (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', '77ab8a79746ce9b96625c6195c27dfbd')) paddle.fluid.layers.elementwise_add (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', '0c9c260e7738165a099f6a76da0b7814'))
paddle.fluid.layers.elementwise_div (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', '128d140ac78c610c35fc38663baf9654')) paddle.fluid.layers.elementwise_div (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', '4701ffd4eb4b7ee19756d3b90532c5f2'))
paddle.fluid.layers.elementwise_sub (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', '061219cf5a710c090eb5b31d0a0d841d')) paddle.fluid.layers.elementwise_sub (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', 'eab2518a801f3f393cf38fddc899c941'))
paddle.fluid.layers.elementwise_mul (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', '57d99bd329b8ea842802a7ea52724163')) paddle.fluid.layers.elementwise_mul (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', '56838de6feabe4e5eef4f58c841eed11'))
paddle.fluid.layers.elementwise_max (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', '3b3c2e528712552f6f44aef88796321d')) paddle.fluid.layers.elementwise_max (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', '27e1e1604433f85cd7c4c320cb7b9a5f'))
paddle.fluid.layers.elementwise_min (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', '817e8ce2b39de9b4a94b1b6d592144e0')) paddle.fluid.layers.elementwise_min (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', 'cdbfe2042da18b0e2a2fd79fde944dc2'))
paddle.fluid.layers.elementwise_pow (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', 'b5e3964c8711058634cf5b57b4884258')) paddle.fluid.layers.elementwise_pow (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', '6fc5d7492830d60c7fa61b3bc8f0d7e7'))
paddle.fluid.layers.elementwise_mod (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', '4101ee1f9280f00dce54054ccc434890')) paddle.fluid.layers.elementwise_mod (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', '4101ee1f9280f00dce54054ccc434890'))
paddle.fluid.layers.elementwise_floordiv (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', '67e6101c31314d4082621e8e443cfb68')) paddle.fluid.layers.elementwise_floordiv (ArgSpec(args=['x', 'y', 'axis', 'act', 'name'], varargs=None, keywords=None, defaults=(-1, None, None)), ('document', '67e6101c31314d4082621e8e443cfb68'))
paddle.fluid.layers.uniform_random_batch_size_like (ArgSpec(args=['input', 'shape', 'dtype', 'input_dim_idx', 'output_dim_idx', 'min', 'max', 'seed'], varargs=None, keywords=None, defaults=('float32', 0, 0, -1.0, 1.0, 0)), ('document', 'cfa120e583cd4a5bfa120c8a26f98a28')) paddle.fluid.layers.uniform_random_batch_size_like (ArgSpec(args=['input', 'shape', 'dtype', 'input_dim_idx', 'output_dim_idx', 'min', 'max', 'seed'], varargs=None, keywords=None, defaults=('float32', 0, 0, -1.0, 1.0, 0)), ('document', 'cfa120e583cd4a5bfa120c8a26f98a28'))
......
...@@ -12387,12 +12387,12 @@ Examples: ...@@ -12387,12 +12387,12 @@ Examples:
def gen_data(): def gen_data():
return { return {
"x": np.array([2, 3, 4]), "x": np.array([2, 3, 4]).astype('float32'),
"y": np.array([1, 5, 2]) "y": np.array([1, 5, 2]).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[3], dtype='float32') x = fluid.data(name="x", shape=[3], dtype='float32')
y = fluid.layers.data(name="y", shape=[3], dtype='float32') y = fluid.data(name="y", shape=[3], dtype='float32')
z = fluid.layers.elementwise_add(x, y) z = fluid.layers.elementwise_add(x, y)
place = fluid.CPUPlace() place = fluid.CPUPlace()
...@@ -12414,8 +12414,8 @@ Examples: ...@@ -12414,8 +12414,8 @@ Examples:
"y": np.zeros((3, 4)).astype('float32') "y": np.zeros((3, 4)).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[2,3,4,5], dtype='float32') x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32')
y = fluid.layers.data(name="y", shape=[3,4], dtype='float32') y = fluid.data(name="y", shape=[3,4], dtype='float32')
z = fluid.layers.elementwise_add(x, y, axis=1) z = fluid.layers.elementwise_add(x, y, axis=1)
place = fluid.CPUPlace() place = fluid.CPUPlace()
...@@ -12438,8 +12438,8 @@ Examples: ...@@ -12438,8 +12438,8 @@ Examples:
"y": np.random.randint(1, 5, size=[5]).astype('float32') "y": np.random.randint(1, 5, size=[5]).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[2,3,4,5], dtype='float32') x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32')
y = fluid.layers.data(name="y", shape=[3,4], dtype='float32') y = fluid.data(name="y", shape=[5], dtype='float32')
z = fluid.layers.elementwise_add(x, y, axis=3) z = fluid.layers.elementwise_add(x, y, axis=3)
place = fluid.CPUPlace() place = fluid.CPUPlace()
...@@ -12464,12 +12464,12 @@ Examples: ...@@ -12464,12 +12464,12 @@ Examples:
def gen_data(): def gen_data():
return { return {
"x": np.array([2, 3, 4]), "x": np.array([2, 3, 4]).astype('float32'),
"y": np.array([1, 5, 2]) "y": np.array([1, 5, 2]).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[3], dtype='float32') x = fluid.data(name="x", shape=[3], dtype='float32')
y = fluid.layers.data(name="y", shape=[3], dtype='float32') y = fluid.data(name="y", shape=[3], dtype='float32')
z = fluid.layers.elementwise_div(x, y) z = fluid.layers.elementwise_div(x, y)
place = fluid.CPUPlace() place = fluid.CPUPlace()
...@@ -12491,8 +12491,8 @@ Examples: ...@@ -12491,8 +12491,8 @@ Examples:
"y": np.zeros((3, 4)).astype('float32') "y": np.zeros((3, 4)).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[2,3,4,5], dtype='float32') x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32')
y = fluid.layers.data(name="y", shape=[3,4], dtype='float32') y = fluid.data(name="y", shape=[3,4], dtype='float32')
z = fluid.layers.elementwise_div(x, y, axis=1) z = fluid.layers.elementwise_div(x, y, axis=1)
place = fluid.CPUPlace() place = fluid.CPUPlace()
...@@ -12515,8 +12515,8 @@ Examples: ...@@ -12515,8 +12515,8 @@ Examples:
"y": np.random.randint(1, 5, size=[5]).astype('float32') "y": np.random.randint(1, 5, size=[5]).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[2,3,4,5], dtype='float32') x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32')
y = fluid.layers.data(name="y", shape=[3,4], dtype='float32') y = fluid.data(name="y", shape=[5], dtype='float32')
z = fluid.layers.elementwise_div(x, y, axis=3) z = fluid.layers.elementwise_div(x, y, axis=3)
place = fluid.CPUPlace() place = fluid.CPUPlace()
...@@ -12541,12 +12541,12 @@ Examples: ...@@ -12541,12 +12541,12 @@ Examples:
def gen_data(): def gen_data():
return { return {
"x": np.array([2, 3, 4]), "x": np.array([2, 3, 4]).astype('float32'),
"y": np.array([1, 5, 2]) "y": np.array([1, 5, 2]).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[3], dtype='float32') x = fluid.data(name="x", shape=[3], dtype='float32')
y = fluid.layers.data(name="y", shape=[3], dtype='float32') y = fluid.data(name="y", shape=[3], dtype='float32')
z = fluid.layers.elementwise_sub(x, y) z = fluid.layers.elementwise_sub(x, y)
place = fluid.CPUPlace() place = fluid.CPUPlace()
...@@ -12568,8 +12568,8 @@ Examples: ...@@ -12568,8 +12568,8 @@ Examples:
"y": np.zeros((3, 4)).astype('float32') "y": np.zeros((3, 4)).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[2,3,4,5], dtype='float32') x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32')
y = fluid.layers.data(name="y", shape=[3,4], dtype='float32') y = fluid.data(name="y", shape=[3,4], dtype='float32')
z = fluid.layers.elementwise_sub(x, y, axis=1) z = fluid.layers.elementwise_sub(x, y, axis=1)
place = fluid.CPUPlace() place = fluid.CPUPlace()
...@@ -12592,8 +12592,8 @@ Examples: ...@@ -12592,8 +12592,8 @@ Examples:
"y": np.random.randint(1, 5, size=[5]).astype('float32') "y": np.random.randint(1, 5, size=[5]).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[2,3,4,5], dtype='float32') x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32')
y = fluid.layers.data(name="y", shape=[3,4], dtype='float32') y = fluid.data(name="y", shape=[5], dtype='float32')
z = fluid.layers.elementwise_sub(x, y, axis=3) z = fluid.layers.elementwise_sub(x, y, axis=3)
place = fluid.CPUPlace() place = fluid.CPUPlace()
...@@ -12618,12 +12618,12 @@ Examples: ...@@ -12618,12 +12618,12 @@ Examples:
def gen_data(): def gen_data():
return { return {
"x": np.array([2, 3, 4]), "x": np.array([2, 3, 4]).astype('float32'),
"y": np.array([1, 5, 2]) "y": np.array([1, 5, 2]).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[3], dtype='float32') x = fluid.data(name="x", shape=[3], dtype='float32')
y = fluid.layers.data(name="y", shape=[3], dtype='float32') y = fluid.data(name="y", shape=[3], dtype='float32')
z = fluid.layers.elementwise_mul(x, y) z = fluid.layers.elementwise_mul(x, y)
place = fluid.CPUPlace() place = fluid.CPUPlace()
...@@ -12645,8 +12645,8 @@ Examples: ...@@ -12645,8 +12645,8 @@ Examples:
"y": np.zeros((3, 4)).astype('float32') "y": np.zeros((3, 4)).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[2,3,4,5], dtype='float32') x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32')
y = fluid.layers.data(name="y", shape=[3,4], dtype='float32') y = fluid.data(name="y", shape=[3,4], dtype='float32')
z = fluid.layers.elementwise_mul(x, y, axis=1) z = fluid.layers.elementwise_mul(x, y, axis=1)
place = fluid.CPUPlace() place = fluid.CPUPlace()
...@@ -12669,8 +12669,8 @@ Examples: ...@@ -12669,8 +12669,8 @@ Examples:
"y": np.random.randint(1, 5, size=[5]).astype('float32') "y": np.random.randint(1, 5, size=[5]).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[2,3,4,5], dtype='float32') x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32')
y = fluid.layers.data(name="y", shape=[3,4], dtype='float32') y = fluid.data(name="y", shape=[5], dtype='float32')
z = fluid.layers.elementwise_mul(x, y, axis=3) z = fluid.layers.elementwise_mul(x, y, axis=3)
place = fluid.CPUPlace() place = fluid.CPUPlace()
...@@ -12695,12 +12695,12 @@ Examples: ...@@ -12695,12 +12695,12 @@ Examples:
def gen_data(): def gen_data():
return { return {
"x": np.array([2, 3, 4]), "x": np.array([2, 3, 4]).astype('float32'),
"y": np.array([1, 5, 2]) "y": np.array([1, 5, 2]).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[3], dtype='float32') x = fluid.data(name="x", shape=[3], dtype='float32')
y = fluid.layers.data(name="y", shape=[3], dtype='float32') y = fluid.data(name="y", shape=[3], dtype='float32')
z = fluid.layers.elementwise_max(x, y) z = fluid.layers.elementwise_max(x, y)
place = fluid.CPUPlace() place = fluid.CPUPlace()
...@@ -12722,8 +12722,8 @@ Examples: ...@@ -12722,8 +12722,8 @@ Examples:
"y": np.zeros((3, 4)).astype('float32') "y": np.zeros((3, 4)).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[2,3,4,5], dtype='float32') x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32')
y = fluid.layers.data(name="y", shape=[3,4], dtype='float32') y = fluid.data(name="y", shape=[3,4], dtype='float32')
z = fluid.layers.elementwise_max(x, y, axis=1) z = fluid.layers.elementwise_max(x, y, axis=1)
place = fluid.CPUPlace() place = fluid.CPUPlace()
...@@ -12749,12 +12749,12 @@ Examples: ...@@ -12749,12 +12749,12 @@ Examples:
def gen_data(): def gen_data():
return { return {
"x": np.array([2, 3, 4]), "x": np.array([2, 3, 4]).astype('float32'),
"y": np.array([1, 5, 2]) "y": np.array([1, 5, 2]).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[3], dtype='float32') x = fluid.data(name="x", shape=[3], dtype='float32')
y = fluid.layers.data(name="y", shape=[3], dtype='float32') y = fluid.data(name="y", shape=[3], dtype='float32')
z = fluid.layers.elementwise_max(x, y) z = fluid.layers.elementwise_max(x, y)
place = fluid.CPUPlace() place = fluid.CPUPlace()
...@@ -12775,8 +12775,8 @@ Examples: ...@@ -12775,8 +12775,8 @@ Examples:
"y": np.zeros((3, 4)).astype('float32') "y": np.zeros((3, 4)).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[2,3,4,5], dtype='float32') x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32')
y = fluid.layers.data(name="y", shape=[3,4], dtype='float32') y = fluid.data(name="y", shape=[3,4], dtype='float32')
z = fluid.layers.elementwise_max(x, y, axis=1) z = fluid.layers.elementwise_max(x, y, axis=1)
place = fluid.CPUPlace() place = fluid.CPUPlace()
...@@ -12802,12 +12802,12 @@ Examples: ...@@ -12802,12 +12802,12 @@ Examples:
def gen_data(): def gen_data():
return { return {
"x": np.array([2, 3, 4]), "x": np.array([2, 3, 4]).astype('float32'),
"y": np.array([1, 5, 2]) "y": np.array([1, 5, 2]).astype('float32')
} }
x = fluid.layers.data(name="x", shape=[3], dtype='float32') x = fluid.data(name="x", shape=[3], dtype='float32')
y = fluid.layers.data(name="y", shape=[3], dtype='float32') y = fluid.data(name="y", shape=[3], dtype='float32')
z = fluid.layers.elementwise_pow(x, y) z = fluid.layers.elementwise_pow(x, y)
place = fluid.CPUPlace() place = fluid.CPUPlace()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册