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

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

by 사이토 고키, 개앞맵시(이복연)
October 2024
Beginner to intermediate
340 pages
7h 38m
Korean
Hanbit Media, Inc.
Content preview from 밑바닥부터 시작하는 딥러닝 5
172
밑바닥부터 시작하는 딥러닝 5
실행 결과
Parameter containing:
tensor([[0
.
0539]], requires_grad
=
True)
Parameter containing:
tensor([0
.
4030], requires_grad
=
True)
Linear
클래스의 인수에서
input
_
size
output
_
size
는 입력할 벡터의 차원 수와 출력할 벡
터의 차원 수입니다. 그리고
self
.
linear
(
x
) 코드로 선형 변환 계산이 이루어집니다.
Linear
인스턴스의 매개변수들은
self
.
linear
.
W
또는
self
.
linear
.
b
에서 확인할 수 있습니다. 또
Linear
인스턴스의 매개변수는
Model
클래스의 매개변수로 자동 등록되므로
model
.
parameters
( )를 호출하면
Linear
인스턴스의 매개변수도 가져옵니다.
6.3.2
옵티마이저
최적화란 신경망의 매개변수를 갱신하는 알고리즘이고
옵티마이저
optimizer
는 최적화 기법을 실
제로 구현한 클래스입니다. 옵티마이저를 이용하면 앞 절과 똑같은 코드를 다음과 같이 구현할
수 있습니다.
#
토이
데이터셋
x
=
torch
.
rand(100, 1)
y
=
5
+
2
*
x
+
torch
.
rand(100, 1)
lr
=
0
.
1
iters
=
100
model
=
Model()
optimizer ...
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