배치 정규화가 뭔가?

민죵·2024년 9월 12일
0

Question

목록 보기
6/25

복잡한 가중치의 분포를 스무딩하게 만들어준다.


import torch
import torch.nn as nn

class MyModel(nn.Module):
    def __init__(self):
        super(MyModel, self).__init__()
        self.fc1 = nn.Linear(128, 64)
        self.bn1 = nn.BatchNorm1d(64)  # 배치 정규화 레이어
        self.fc2 = nn.Linear(64, 10)
    
    def forward(self, x):
        x = self.fc1(x)
        x = self.bn1(x)  # 배치 정규화 적용
        x = torch.relu(x)
        x = self.fc2(x)
        return x

model = MyModel()

profile
빅데이터 / 인공지능 석사 과정 (살아남쨔 뀨륙뀨륙)

0개의 댓글