class Liner(nn.Module):
def __init__(self, in_ch, out_ch):
super(Linear, self).__init__()
self.w = nn.Parameter(torch.randn(in_ch, out_ch))
self.b = nn.Parameter(torch.randn(out_ch))
def forwar(self, x)
out = torch.matmul(x, w) + b
【手撕算法系列】Linear层
最新推荐文章于 2024-04-26 08:47:48 发布