Data/Data Science
2020. 3. 11.
[Pytorch] Linear Regression Prediction
간단한 Linear Regression모델 선언 import torch.nn as nn class LR(nn.Module): def __init__(self, in_size, output_size): super(LR, self).__init__() self.linear = nn.Linear(in_size, output_size) def forward(self, x): out = self.linear(x) return out # Linear Regression model 생성 model = LR(1, 1) # Linear Regression bias, weight 변수 확인 model.state_dict() """ OrderedDict([('linear.weight', tensor([[-0.3027]]))..