import torch import torch.nn as nn import torch.nn.functional as F # 모델을 선언 및 초기화. 단순 선형 회귀이므로 input_dim=1, output_dim=1. model = nn.Linear(1,1) class LinearRegressionModel(nn.Module): # torch.nn.Module을 상속받는 파이썬 클래스 def __init__(self): super().
__init__() self.linear = nn.Linear(1, 1) # 단순 선형 회귀이므로 input_dim=1, output_dim=1. def forward(self, x): return self.linear(x) class MultivariateLinearRegressionModel(nn.Module): def __init__(self): super().__init__() self.linear = nn.Linear(3, 1) # 다중 선형 ...
원문 링크 : 선형회귀_클래스로파이토치