【手撕算法系列】Linear层

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

你可能感兴趣的:(手撕算法,pytorch,深度学习,人工智能)