5장. 손실함수
1. 손실함수 N개의 데이터 샘플, n차원 L1 L2 : Euclidean distance RMSE MSE MSE는 L2 노름의 제곱에 상수를 곱한 2. 실습 def mse(x_hat, x): # |x|=(batch_size, dim) print((x-x_hat)**2) y=((x-x_hat)**2).mean() return y x=torch.FloatTensor([[1,1],[2,2]]) x_hat=torch.FloatTensor([[0,0],[0,0]]) print(mse(x_hat,x)) #2.5 torch.nn.function 사용 import torch.nn.functional as F F.mse_loss(x_hat,x) #2.5 F.mse_loss(x_hat,x, reduction='sum')..
2024. 4. 10.