- paddle.incubate.nn.functional. fused_matmul_bias ( x, y, bias=None, transpose_x=False, transpose_y=False, name=None ) [source]
Applies matrix multiplication of two tensors and then bias addition if provided. This method requires CUDA version >= 11.6.
x (Tensor) – the first input Tensor to be multiplied.
y (Tensor) – the second input Tensor to be multiplied. Its rank must be 2.
bias (Tensor|None) – the input bias Tensor. If it is None, no bias addition would be performed. Otherwise, the bias is added to the matrix multiplication result.
transpose_x (bool) – Whether to transpose \(x\) before multiplication.
transpose_y (bool) – Whether to transpose \(y\) before multiplication.
name (str|None) – For detailed information, please refer to Name . Usually name is no need to set and None by default.
the output Tensor.
- Return type
# required: gpu import paddle from paddle.incubate.nn.functional import fused_matmul_bias x = paddle.randn([3, 4]) y = paddle.randn([4, 5]) bias = paddle.randn() out = fused_matmul_bias(x, y, bias) print(out.shape) # [3, 5]