- paddle.fluid.layers.nn. scale ( x, scale=1.0, bias=0.0, bias_after_scale=True, act=None, name=None ) [source]
Putting scale and bias to the input Tensor as following:
x (Tensor) – Input N-D Tensor of scale operator. Data type can be float32, float64, int8, int16, int32, int64, uint8.
scale (float|Tensor) – The scale factor of the input, it should be a float number or a Tensor with shape  and data type as float32.
bias (float) – The bias to be put on the input.
bias_after_scale (bool) – Apply bias addition after or before scaling. It is useful for numeric stability in some circumstances.
act (str, optional) – Activation applied to the output such as tanh, softmax, sigmoid, relu.
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
Output tensor of scale operator, with shape and data type same as input.
- Return type
# scale as a float32 number import paddle data = paddle.randn(shape=[2,3], dtype='float32') res = paddle.scale(data, scale=2.0, bias=1.0)
# scale with parameter scale as a Tensor import paddle data = paddle.randn(shape=[2, 3], dtype='float32') factor = paddle.to_tensor(, dtype='float32') res = paddle.scale(data, scale=factor, bias=1.0)