鲲鹏社区首页
中文
注册
开发者
我要评分
获取效率
正确性
完整性
易理解
在线提单
论坛求助

Linear

接口功能

Pytorch的Linear用于创建全连接层,进行线性变换

函数原型

torch.nn.Linear(
    in_features: int, 
    out_features: int, 
    bias: bool = True, 
    device=None, 
    dtype=None
)

参数说明

表1 参数说明

参数

类型

必填

说明

in_feature

int

输入特性维度。

out_feature

int

输出特征维度。

bias

bool

是否包含偏置(默认True)。

device

torch.device

计算设备(如“cpu”,“cuda”)。

dtype

torch.dtype

权重数据类型(如torch.float16、torch.float32)。