로딩
요청 처리 중입니다...

선형회귀_기초

 선형회귀_기초

import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim torch.manual_seed(1) x_train = torch.FloatTensor([[1], [2], [3]]) y_train = torch.FloatTensor([[2], [4], [6]]) print(x_train) print(x_train.shape) print(y_train) print(y_train.shape) # 가중치 W를 0으로 초기화하고 학습을 통해 값이 변경되는 변수임을 명시함. W = torch.zeros(1, requires_grad=True) # 가중치 W를 출력 print(W) b = torch.zeros(1, requires_grad=True) print(b) hypothesis = x_train * W + b print(hypothesis) # 앞서 배운 torch.mean으로 평균...

원문 링크 : 선형회귀_기초