|
|
|
@ -168,18 +168,19 @@ def pow(input, exponent, out=None, name=None):
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
import paddle
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
|
|
|
|
|
x = paddle.fluid.data(name="x", shape=[32,32], dtype="float32")
|
|
|
|
|
x = fluid.data(name="x", shape=[32,32], dtype="float32")
|
|
|
|
|
|
|
|
|
|
# example 1: argument exponent is float
|
|
|
|
|
res = paddle.fluid.data(name="output", shape=[32,32], dtype="float32")
|
|
|
|
|
res = fluid.data(name="output", shape=[32,32], dtype="float32")
|
|
|
|
|
y_1 = paddle.pow(x, 2.0, out=res)
|
|
|
|
|
# y_1 is x^{2.0}
|
|
|
|
|
|
|
|
|
|
# example 2: argument exponent is Variable
|
|
|
|
|
exponet_tensor = fluid.layers.fill_constant([1], "float32", 3.0)
|
|
|
|
|
res = paddle.fluid.data(name="output", shape=[32,32], dtype="float32")
|
|
|
|
|
y_2 = paddle.pow(x, exponent_tensor, out=res)
|
|
|
|
|
res = fluid.data(name="output", shape=[32,32], dtype="float32")
|
|
|
|
|
y_2 = paddle.pow(x, exponet_tensor, out=res)
|
|
|
|
|
# y_2 is x^{3.0}
|
|
|
|
|
"""
|
|
|
|
|
helper = LayerHelper('pow', **locals())
|
|
|
|
@ -254,10 +255,11 @@ def mul(x, y, x_num_col_dims=1, y_num_col_dims=1, out=None, name=None):
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
import paddle
|
|
|
|
|
dataX = paddle.fluid.data(name="dataX", append_batch_size = False, shape=[2, 5], dtype="float32")
|
|
|
|
|
dataY = paddle.fluid.data(name="dataY", append_batch_size = False, shape=[5, 3], dtype="float32")
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
dataX = fluid.data(name="dataX", shape=[2, 5], dtype="float32")
|
|
|
|
|
dataY = fluid.data(name="dataY", shape=[5, 3], dtype="float32")
|
|
|
|
|
|
|
|
|
|
res = paddle.fluid.data(name="output", append_batch_size = False, shape=[2, 3], dtype="float32")
|
|
|
|
|
res = fluid.data(name="output", shape=[2, 3], dtype="float32")
|
|
|
|
|
output = paddle.mul(dataX, dataY,
|
|
|
|
|
x_num_col_dims = 1,
|
|
|
|
|
y_num_col_dims = 1,
|
|
|
|
|