bilinear¶
- paddle.nn.functional. bilinear ( x1, x2, weight, bias=None, name=None ) [source]
-
This layer performs bilinear on two inputs. See Bilinear for details and output shape.
- Parameters
-
x1 (Tensor) – the first input tensor, it’s data type should be float32, float64.
x2 (Tensor) – the second input tensor, it’s data type should be float32, float64.
weight (Parameter) – The learnable weights of this layer, shape is [out_features, in1_features, in2_features].
bias (Parameter, optional) – The learnable bias(Bias) of this layer, shape is [1, out_features]. If it is set to None, no bias will be added to the output units. The default value is None.
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. Default: None.
- Returns
-
A 2-D Tensor of shape [batch_size, out_features].
- Return type
-
Tensor
Examples
>>> import paddle >>> import paddle.nn.functional as F >>> x1 = paddle.randn((5, 5)).astype(paddle.float32) >>> x2 = paddle.randn((5, 4)).astype(paddle.float32) >>> w = paddle.randn((1000, 5, 4)).astype(paddle.float32) >>> b = paddle.randn((1, 1000)).astype(paddle.float32) >>> result = F.bilinear(x1, x2, w, b) >>> print(result.shape) [5, 1000]