torch.nn.modules.linear—Bilinear

本文介绍了PyTorch中的Bilinear模块,用于执行双线性变换。该模块接受两个输入,其最后一个维度应匹配参数设置。输出同样保持其他维度不变。内容包括功能描述、形状规则和实例应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

功能描述

Applies a bilinear transformation to the incoming data: math:`y = x_1^T A x_2 + b`
Shape:
Input1: (N, *, Hin1) where Hin1 =  in1_features and * means any number of additional dimensions. All but the last dimension of the inputs should be the same.
Input2: (N, *, Hin2) where Hin2 =  in2_features.
Output: (N, *, Hout) where Hout = out_features and all but the last dimension are the same shape as the input.

该函数主要的作用是对于输入的数据进行双线性的变换,它有两个输入,并且对于输入、输出的最后一个维度应该和nn.Bilinear(in1_features,in2_features,out_features)是相同的。在该函数中bias服从均匀分布

 examples:

# 导入所需要的包
import torch
import torch.nn as nn


# 对于输入数据进行双线性变换  math:`y = x_1^T A x_2 + b`
# ['in1_features', 'in2_features', 'out_features']
m=nn.Bilin
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值