Skip to Content
밑바닥부터 시작하는 딥러닝 5
book

밑바닥부터 시작하는 딥러닝 5

by 사이토 고키, 개앞맵시(이복연)
October 2024
Beginner to intermediate
340 pages
7h 38m
Korean
Hanbit Media, Inc.
Content preview from 밑바닥부터 시작하는 딥러닝 5
324
밑바닥부터 시작하는 딥러닝 5
C.5
구현 코드
데이터셋은
MNIST
를 사용합니다. 먼저 임포트 문과 신경망 구현 코드를 보겠습니다.
import matplotlib
.
pyplot as plt
import torch
import torch
.
nn as nn
import torch
.
nn
.
functional as F
import torch
.
optim as optim
import torchvision
from torchvision import datasets, transforms
#
하이퍼파라미터
설정
input
_
dim
=
784
hidden
_
dim
=
100
latent
_
dim
=
20
epochs
=
30
learning
_
rate
=
1e
-
3
batch
_
size
=
32
class Encoder(nn
.
Module):
def
__
init
__
(self, input
_
dim, hidden
_
dim, latent
_
dim):
super()
.
__
init
__
()
self
.
linear
=
nn
.
Linear(input
_
dim, hidden
_
dim)
self
.
linear
_
mu
=
nn
.
Linear(hidden
_
dim, latent
_
dim)
self
.
linear
_
logvar
=
nn
.
Linear(hidden
_
dim, latent
_
dim)
def forward(self, x):
h
=
self
.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

밑바닥부터 시작하는 딥러닝 4

밑바닥부터 시작하는 딥러닝 4

사이토 고키

Publisher Resources

ISBN: 9791169212960