See :ref:`api_nn_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 :ref:`api_guide_Name`. Default: None.
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 :ref:`api_guide_Name`. Default: None.
Returns:
Tensor: A 2-D Tensor of shape [batch_size, out_features].
Tensor: A 2-D Tensor of shape [batch_size, out_features].
Examples:
.. code-block:: python
.. code-block:: python
import paddle
import paddle.nn.functional as F
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)
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]
result = F.bilinear(x1, x2, w, b)
print(result.shape)
# [5, 1000]
"""
ifin_dygraph_mode():
...
...
@@ -1008,38 +1008,38 @@ def dropout(x,
.. code-block:: python
import paddle
x = paddle.to_tensor([[1,2,3], [4,5,6]]).astype(paddle.float32)
name (str, optional): Name for the operation (optional, default is None).
For more information, please refer to :ref:`api_guide_Name`.
Shape:
input: N-D Tensor, the shape is [N, \*], N is batch size and `\*` means number of classes, available dtype is float32, float64. The sum operationoperates over all the elements.
label: N-D Tensor, same shape as the input.
weight:N-D Tensor, the shape is [N,1]
output: scalar. If :attr:`reduction` is ``'none'``, then same shape as the input.
Shape:
input: N-D Tensor, the shape is [N, \*], N is batch size and `\*` means number of classes, available dtype is float32, float64. The sum operationoperates over all the elements.
label: N-D Tensor, same shape as the input.
weight:N-D Tensor, the shape is [N,1]
output: scalar. If :attr:`reduction` is ``'none'``, then same shape as the input.
Returns:
Tensor, The tensor variable storing the multi_label_soft_margin_loss of input and label.
Returns:
Tensor, The tensor variable storing the multi_label_soft_margin_loss of input and label.
or user can define their own distance function. `margin` is a nonnegative margin representing the minimum difference
between the positive and negative distances that is required for the loss to be 0. If `swap` is true, it will compare distance of (input, negative) with
...
...
@@ -1510,15 +1510,15 @@ class TripletMarginWithDistanceLoss(Layer):
Shapes:
input (Tensor):Input tensor, the data type is float32 or float64.
the shape is [N, \*], N is batch size and `\*` means any number of additional dimensions, available dtype is float32, float64.
the shape is [N, \*], N is batch size and `\*` means any number of additional dimensions, available dtype is float32, float64.
positive (Tensor):Positive tensor, the data type is float32 or float64.
The shape of label is the same as the shape of input.
The shape of label is the same as the shape of input.
negative (Tensor):Negative tensor, the data type is float32 or float64.
The shape of label is the same as the shape of input.
The shape of label is the same as the shape of input.
output(Tensor): The tensor variable storing the triplet_margin_with_distance_loss of input and positive and negative.
output(Tensor): The tensor variable storing the triplet_margin_with_distance_loss of input and positive and negative.
Return:
A callable object of TripletMarginWithDistanceLoss
overwrite (bool): The mode that updating the output when there are same indices.
If True, use the overwrite mode to update the output of the same index,
if False, use the accumulate mode to update the output of the same index.Default value is True.
if False, use the accumulate mode to update the output of the same index.Default value is True.
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 :ref:`api_guide_Name` .