fused_bias_act

paddle.incubate.nn.functional. fused_bias_act ( x: Tensor, bias: Tensor | None = None, dequant_scales: Tensor | None = None, shift: Tensor | None = None, smooth: Tensor | None = None, act_method: str = 'gelu', compute_dtype: str = 'default', quant_scale: float = - 1, quant_round_type: int = 0, quant_max_bound: float = 0, quant_min_bound: float = 0 ) Tensor [source]

Applies fused_bias_act kernel

Parameters
  • x (Tensor) – the input Tensor.

  • bias (Tensor, optional) – the input bias Tensor. If it is None, no bias addition would be performed. Otherwise, the bias will be added before activation function. Default: None.

  • dequant_scales (Tensor, optional) – the dequantization scale tensor, If it is None, no dequantization will be performed. Default: None.

  • shift (Tensor, optional) – the shift tensor, used to shift the input tensor before activation function. If None, no translation will be performed. Default: None.

  • smooth (Tensor, optional) – the smooth tensor, used to smooth the input tensor before activation function. If None, no smoothing processing will be performed. Default: None.

  • act_method (Str, optional) – the activation method, specify the activation function to be used. Default: gelu.

  • compute_dtype (Str, optional) – a compute dtype, is used to represent the input data type. Default is “default”, which means compute dtype is determined by input dtype.

  • quant_scale (Float, optional) – the quant scale. Default: -1.

  • quant_round_type (Int, optional) – the quant round type, if 0 is set, value will be rounding to nearest ties to even. If 1 is set, value will be rounding to nearest ties away from zero. Default: 0.

  • quant_max_bound (Float, optional) – the max bound of float type to int type. Default: 0.

  • quant_min_bound (Float, optional) – the min bound of float type to int type. Default: 0.

Returns

the output Tensor.

Return type

Tensor

Examples

>>> 
>>> import paddle
>>> from paddle.incubate.nn.functional import fused_bias_act

>>> paddle.set_device('gpu')
>>> x = paddle.randn([3, 5])
>>> bias = paddle.randn([5])
>>> out = fused_bias_act(x, bias)
>>> print(out.shape)
[3, 5]