pow¶
- paddle.fluid.layers.nn. pow ( x, factor=1.0, name=None ) [source]
-
This is Pow Activation Operator.
\(out = x^{factor}\)
- Parameters
-
x (Variable) – A
Tensor
orLoDTensor
. The data type isfloat32
orfloat64
.factor (float32|Variable, optional) – A scalar with type
float32
or aTensor
with shape [1] and typefloat32
. The exponential factor of Pow. Default 1.0.name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name .
- Returns
-
A
Tensor
orLoDTensor
. The data type is same asx
. - Return type
-
Variable
Examples
import paddle.fluid as fluid x = fluid.data(name="x", shape=[32,32], dtype="float32") # example 1: argument factor is float y_1 = fluid.layers.pow(x, factor=2.0) # y_1 is x^{2.0} # example 2: argument factor is Variable factor_tensor = fluid.layers.fill_constant([1], "float32", 3.0) y_2 = fluid.layers.pow(x, factor=factor_tensor) # y_2 is x^{3.0}