Linear 的初始化部分: class Linear(Module): ... __constants__ = [bias] def __init__(self, in_features, out_features, bias=True): super(Linear, self).__init__() self.in_features = in_features self.out_features = out_features self.weight = P
Linear 的初始化部分:
需要实现的内容: ![]() 计算步骤:
返回的是:input * weight + bias 对于 weight
对于 bias
实例展示 举个例子:
张量的大小由 140 x 100 变成了 140 x 50 执行的操作是: [140,100]×[100,50]=[140,50] |
2019-06-18
2019-07-04
2021-05-23
2021-05-27
2021-05-27