scale

    缩放算子。

    对输入Tensor进行缩放和偏置,其公式如下:

    bias_after_scale 为True:

    Out\=scale∗(X+bias)Out\=scale∗(X+bias)

    参数:

    • x (Tensor) - 要进行缩放的多维Tensor,数据类型可以为float32,float64,int8,int16,int32,int64,uint8。

    • scale (float|Tensor) - 缩放的比例,是一个float类型或者一个shape为[1],数据类型为float32的Tensor类型。

    • act (str,可选) - 应用于输出的激活函数,如tanh、softmax、sigmoid、relu等。

    • name (str,可选) - 具体用法请参见 ,一般无需设置,默认值为None。

    返回: Tensor,缩放后的计算结果。

    1. factor = paddle.to_tensor([2], dtype='float32')