def __init__
函数功能
类初始化函数。
函数原型
def __init__(self, in_features: int, out_features: int, bias: bool = True, device=None, dtype=None, op_type="matmulv2") -> None:
参数说明
参数名 |
输入/输出 |
类型 |
说明 |
---|---|---|---|
in_features |
输入 |
int |
输入特征的维度(即输入张量的最后一维大小)。 |
out_features |
输入 |
int |
输出特征的维度(即输出张量的最后一维大小)。 |
bias |
输入 |
bool |
是否启用偏置项。
|
device |
输入 |
str |
指定权重和偏置参数存储的设备(如:"cpu"或"npu")。 |
dtype |
输入 |
str |
指定权重和偏置参数的数据类型(如:torch.float32、torch.bfloat16或torch.float16)。 |
op_type |
输入 |
str |
可选值有:"matmulv3"、"batchmatmulv3"、"matmulv2"和"batchmatmulv2";默认值为"matmulv2"。 |
返回值说明
无
父主题: Linear