Skip to content

Commit a9f03c6

Browse files
committed
1 parent efe11eb commit a9f03c6

29 files changed

+4550
-36
lines changed

โ€ŽREADME.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ PyTorch์—์„œ ์ œ๊ณตํ•˜๋Š” ํŠœํ† ๋ฆฌ์–ผ์˜ ํ•œ๊ตญ์–ด ๋ฒˆ์—ญ์„ ์œ„ํ•œ ์ €์žฅ์†Œ
2222

2323
## ์›๋ฌธ
2424

25-
ํ˜„์žฌ PyTorch v1.9 ํŠœํ† ๋ฆฌ์–ผ ๋ฒˆ์—ญ์ด ์ง„ํ–‰ ์ค‘์ž…๋‹ˆ๋‹ค. ([pytorch/tutorials@2571e95](https://github.com/pytorch/tutorials/commit/2571e95df42b8ed46d11ac9827c637fa4e826dfe) ๊ธฐ์ค€)
25+
ํ˜„์žฌ PyTorch v1.10.1 ํŠœํ† ๋ฆฌ์–ผ([pytorch/tutorials@444fbd1](https://github.com/pytorch/tutorials/commit/444fbd16f2ddf9967baf8b06e83867a141b071c2) ๊ธฐ์ค€) ๋ฒˆ์—ญ์ด ์ง„ํ–‰ ์ค‘์ž…๋‹ˆ๋‹ค.
2626

2727
์ตœ์‹  ๋ฒ„์ „์˜ ํŠœํ† ๋ฆฌ์–ผ(๊ณต์‹, ์˜์–ด)์€ [PyTorch tutorials ์‚ฌ์ดํŠธ](https://pytorch.org/tutorials) ๋ฐ [PyTorch tutorials ์ €์žฅ์†Œ](https://github.com/pytorch/tutorials)๋ฅผ ์ฐธ๊ณ ํ•ด์ฃผ์„ธ์š”.
2828

@@ -46,5 +46,5 @@ v1.0 ์ดํ›„ ๋ฒˆ์—ญ์€ ๋ณ„๋„ ์ €์žฅ์†Œ๋กœ ๊ด€๋ฆฌํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. [์ด ์ €์žฅ
4646
| 0.3.1 | [PyTorch-tutorials-kr-0.3.1](https://9bow.github.io/PyTorch-tutorials-kr-0.3.1) | [GitHub ์ €์žฅ์†Œ](https://github.com/9bow/PyTorch-tutorials-kr-0.3.1) |
4747

4848
---
49-
This is a project to translate [pytorch/tutorials@2571e95](https://github.com/pytorch/tutorials/commit/2571e95df42b8ed46d11ac9827c637fa4e826dfe) into Korean.
49+
This is a project to translate [pytorch/tutorials@444fbd1](https://github.com/pytorch/tutorials/commit/444fbd16f2ddf9967baf8b06e83867a141b071c2) into Korean.
5050
For the latest version, please visit to the [official PyTorch tutorials repo](https://github.com/pytorch/tutorials).

โ€Žadvanced_source/torch_script_custom_ops.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,13 +579,13 @@ custom operator, that loads and executes a serialized TorchScript model:
579579
}
580580
581581
// Deserialize the ScriptModule from a file using torch::jit::load().
582-
std::shared_ptr<torch::jit::script::Module> module = torch::jit::load(argv[1]);
582+
torch::jit::script::Module module = torch::jit::load(argv[1]);
583583
584584
std::vector<torch::jit::IValue> inputs;
585585
inputs.push_back(torch::randn({4, 8}));
586586
inputs.push_back(torch::randn({8, 5}));
587587
588-
torch::Tensor output = module->forward(std::move(inputs)).toTensor();
588+
torch::Tensor output = module.forward(std::move(inputs)).toTensor();
589589
590590
std::cout << output << std::endl;
591591
}
@@ -1029,5 +1029,5 @@ visible to TorchScript:
10291029
10301030
>>> import torch
10311031
>>> torch.ops.load_library("warp_perspective.so")
1032-
>>> print(torch.ops.custom.warp_perspective)
1032+
>>> print(torch.ops.my_ops.warp_perspective)
10331033
<built-in method custom::warp_perspective of PyCapsule object at 0x7ff51c5b7bd0>

โ€Žbeginner_source/basics/optimization_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def forward(self, x):
135135
#####################################
136136
# ํ•™์Šต ๋‹จ๊ณ„(loop)์—์„œ ์ตœ์ ํ™”๋Š” ์„ธ๋‹จ๊ณ„๋กœ ์ด๋ค„์ง‘๋‹ˆ๋‹ค:
137137
# * ``optimizer.zero_grad()``\ ๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ๋ชจ๋ธ ๋งค๊ฐœ๋ณ€์ˆ˜์˜ ๋ณ€ํ™”๋„๋ฅผ ์žฌ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ๋ณธ์ ์œผ๋กœ ๋ณ€ํ™”๋„๋Š” ๋”ํ•ด์ง€๊ธฐ(add up) ๋•Œ๋ฌธ์— ์ค‘๋ณต ๊ณ„์‚ฐ์„ ๋ง‰๊ธฐ ์œ„ํ•ด ๋ฐ˜๋ณตํ•  ๋•Œ๋งˆ๋‹ค ๋ช…์‹œ์ ์œผ๋กœ 0์œผ๋กœ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
138-
# * ``loss.backward()``\ ๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์˜ˆ์ธก ์†์‹ค(prediction loss)์„ ์—ญ์ „ํŒŒํ•ฉ๋‹ˆ๋‹ค. PyTorch๋Š” ๊ฐ ๋งค๊ฐœ๋ณ€์ˆ˜์— ๋Œ€ํ•œ ์†์‹ค์˜ ๋ณ€ํ™”๋„๋ฅผ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.
138+
# * ``loss.backwards()``\ ๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์˜ˆ์ธก ์†์‹ค(prediction loss)์„ ์—ญ์ „ํŒŒํ•ฉ๋‹ˆ๋‹ค. PyTorch๋Š” ๊ฐ ๋งค๊ฐœ๋ณ€์ˆ˜์— ๋Œ€ํ•œ ์†์‹ค์˜ ๋ณ€ํ™”๋„๋ฅผ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.
139139
# * ๋ณ€ํ™”๋„๋ฅผ ๊ณ„์‚ฐํ•œ ๋’ค์—๋Š” ``optimizer.step()``\ ์„ ํ˜ธ์ถœํ•˜์—ฌ ์—ญ์ „ํŒŒ ๋‹จ๊ณ„์—์„œ ์ˆ˜์ง‘๋œ ๋ณ€ํ™”๋„๋กœ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ์กฐ์ •ํ•ฉ๋‹ˆ๋‹ค.
140140

141141

โ€Žbeginner_source/blitz/autograd_tutorial.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@
3232
3333
ํ•™์Šต ๋‹จ๊ณ„๋ฅผ ํ•˜๋‚˜๋งŒ ์‚ดํŽด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์—์„œ๋Š” ``torchvision`` ์—์„œ ๋ฏธ๋ฆฌ ํ•™์Šต๋œ resnet18 ๋ชจ๋ธ์„ ๋ถˆ๋Ÿฌ์˜ต๋‹ˆ๋‹ค.
3434
3์ฑ„๋„์งœ๋ฆฌ ๋†’์ด์™€ ๋„“์ด๊ฐ€ 64์ธ ์ด๋ฏธ์ง€ ํ•˜๋‚˜๋ฅผ ํ‘œํ˜„ํ•˜๋Š” ๋ฌด์ž‘์œ„์˜ ๋ฐ์ดํ„ฐ ํ…์„œ๋ฅผ ์ƒ์„ฑํ•˜๊ณ , ์ด์— ์ƒ์‘ํ•˜๋Š” ``label(์ •๋‹ต)`` ์„
35-
๋ฌด์ž‘์œ„ ๊ฐ’์œผ๋กœ ์ดˆ๊ธฐํ™”ํ•ฉ๋‹ˆ๋‹ค.
35+
๋ฌด์ž‘์œ„ ๊ฐ’์œผ๋กœ ์ดˆ๊ธฐํ™”ํ•ฉ๋‹ˆ๋‹ค. ๋ฏธ๋ฆฌ ํ•™์Šต๋œ ๋ชจ๋ธ์˜ ์ •๋‹ต(label)์€ (1, 1000)์˜ ๋ชจ์–‘(shape)์„ ๊ฐ–์Šต๋‹ˆ๋‹ค.
36+
37+
.. note::
38+
์ด ํŠœํ† ๋ฆฌ์–ผ์€ (ํ…์„œ๋ฅผ CUDA๋กœ ์ด๋™ํ•˜๋”๋ผ๋„) GPU์—์„œ๋Š” ๋™์ž‘ํ•˜์ง€ ์•Š์œผ๋ฉฐ CPU์—์„œ๋งŒ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค.
39+
3640
"""
3741
import torch, torchvision
3842
model = torchvision.models.resnet18(pretrained=True)
@@ -59,8 +63,8 @@
5963

6064
############################################################
6165
# ๋‹ค์Œ์œผ๋กœ, ์˜ตํ‹ฐ๋งˆ์ด์ €(optimizer)๋ฅผ ๋ถˆ๋Ÿฌ์˜ต๋‹ˆ๋‹ค.
62-
# ์ด ์˜ˆ์ œ์—์„œ๋Š” ํ•™์Šต์œจ(learning rate) 0.1๊ณผ ๋ชจ๋ฉ˜ํ…€(momentum) 0.9๋ฅผ ๊ฐ–๋Š” SGD์ž…๋‹ˆ๋‹ค.
63-
# ์˜ตํ‹ฐ๋งˆ์ด์ €(optimizer)์— ๋ชจ๋ธ์˜ ๋ชจ๋“  ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ๋“ฑ๋กํ•ฉ๋‹ˆ๋‹ค.
66+
# ์ด ์˜ˆ์ œ์—์„œ๋Š” ํ•™์Šต์œจ(learning rate) 0.1๊ณผ `๋ชจ๋ฉ˜ํ…€(momentum) <https://towardsdatascience.com/stochastic-gradient-descent-with-momentum-a84097641a5d>`__
67+
# 0.9๋ฅผ ๊ฐ–๋Š” SGD์ž…๋‹ˆ๋‹ค. ์˜ตํ‹ฐ๋งˆ์ด์ €(optimizer)์— ๋ชจ๋ธ์˜ ๋ชจ๋“  ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ๋“ฑ๋กํ•ฉ๋‹ˆ๋‹ค.
6468
#
6569

6670
optim = torch.optim.SGD(model.parameters(), lr=1e-2, momentum=0.9)
@@ -234,7 +238,7 @@
234238
# .. note::
235239
# **PyTorch์—์„œ DAG๋“ค์€ ๋™์ (dynamic)์ž…๋‹ˆ๋‹ค.**
236240
# ์ฃผ๋ชฉํ•ด์•ผ ํ•  ์ค‘์š”ํ•œ ์ ์€ ๊ทธ๋ž˜ํ”„๊ฐ€ ์ฒ˜์Œ๋ถ€ํ„ฐ(from scratch) ๋‹ค์‹œ ์ƒ์„ฑ๋œ๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค; ๋งค๋ฒˆ ``.backward()`` ๊ฐ€
237-
# ํ˜ธ์ถœ๋˜๊ณ  ๋‚˜๋ฉด, autograd๋Š” ์ƒˆ๋กœ์šด ๊ทธ๋ž˜ํ”„๋ฅผ ์ฑ„์šฐ๊ธฐ(populate) ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์  ๋•๋ถ„์— ๋ชจ๋ธ์—์„œ
241+
# ํ˜ธ์ถœ๋˜๊ณ  ๋‚˜๋ฉด, autograd๋Š” ์ƒˆ๋กœ์šด ๊ทธ๋ž˜ํ”„๋ฅผ ์ฑ„์šฐ๊ธฐ(populate) ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์  ๋•๋ถ„์— ๋ชจ๋ธ์—์„œ
238242
# ํ๋ฆ„ ์ œ์–ด(control flow) ๊ตฌ๋ฌธ๋“ค์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค; ๋งค๋ฒˆ ๋ฐ˜๋ณต(iteration)ํ•  ๋•Œ๋งˆ๋‹ค ํ•„์š”ํ•˜๋ฉด
239243
# ๋ชจ์–‘(shape)์ด๋‚˜ ํฌ๊ธฐ(size), ์—ฐ์‚ฐ(operation)์„ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
240244
#
@@ -286,14 +290,14 @@
286290
model.fc = nn.Linear(512, 10)
287291

288292
######################################################################
289-
# ์ด์ œ ``model.fc`` ๋ฅผ ์ œ์™ธํ•œ ๋ชจ๋ธ์˜ ๋ชจ๋“  ๋งค๊ฐœ๋ณ€์ˆ˜๋“ค์ด ๊ณ ์ •๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
293+
# ์ด์ œ ``model.fc`` ๋ฅผ ์ œ์™ธํ•œ ๋ชจ๋ธ์˜ ๋ชจ๋“  ๋งค๊ฐœ๋ณ€์ˆ˜๋“ค์ด ๊ณ ์ •๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
290294
# ๋ณ€ํ™”๋„๋ฅผ ๊ณ„์‚ฐํ•˜๋Š” ์œ ์ผํ•œ ๋งค๊ฐœ๋ณ€์ˆ˜๋Š” ``model.fc`` ์˜ ๊ฐ€์ค‘์น˜(weight)์™€ ํŽธํ–ฅ(bias)๋ฟ์ž…๋‹ˆ๋‹ค.
291295

292296
# ๋ถ„๋ฅ˜๊ธฐ๋งŒ ์ตœ์ ํ™”ํ•ฉ๋‹ˆ๋‹ค.
293297
optimizer = optim.SGD(model.parameters(), lr=1e-2, momentum=0.9)
294298

295299
##########################################################################
296-
# ์˜ตํ‹ฐ๋งˆ์ด์ €(optimizer)์— ๋ชจ๋“  ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ๋“ฑ๋กํ•˜๋”๋ผ๋„,
300+
# ์˜ตํ‹ฐ๋งˆ์ด์ €(optimizer)์— ๋ชจ๋“  ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ๋“ฑ๋กํ•˜๋”๋ผ๋„,
297301
# ๋ณ€ํ™”๋„๋ฅผ ๊ณ„์‚ฐ(ํ•˜๊ณ  ๊ฒฝ์‚ฌํ•˜๊ฐ•๋ฒ•์œผ๋กœ ๊ฐฑ์‹ )ํ•  ์ˆ˜ ์žˆ๋Š” ๋งค๊ฐœ๋ณ€์ˆ˜๋“ค์€ ๋ถ„๋ฅ˜๊ธฐ์˜ ๊ฐ€์ค‘์น˜์™€ ํŽธํ–ฅ๋ฟ์ž…๋‹ˆ๋‹ค.
298302
#
299303
# ์ปจํ…์ŠคํŠธ ๋งค๋‹ˆ์ €(context manager)์— `torch.no_grad() <https://pytorch.org/docs/stable/generated/torch.no_grad.html>`__

โ€Žbeginner_source/blitz/cifar10_tutorial.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def imshow(img):
109109
# ์ด๋ฏธ์ง€ ๋ณด์—ฌ์ฃผ๊ธฐ
110110
imshow(torchvision.utils.make_grid(images))
111111
# ์ •๋‹ต(label) ์ถœ๋ ฅ
112-
print(' '.join('%5s' % classes[labels[j]] for j in range(batch_size)))
112+
print(' '.join(f'{classes[labels[j]]:5s}' for j in range(batch_size)))
113113

114114

115115
########################################################################
@@ -181,8 +181,7 @@ def forward(self, x):
181181
# ํ†ต๊ณ„๋ฅผ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.
182182
running_loss += loss.item()
183183
if i % 2000 == 1999: # print every 2000 mini-batches
184-
print('[%d, %5d] loss: %.3f' %
185-
(epoch + 1, i + 1, running_loss / 2000))
184+
print(f'[{epoch + 1}, {i + 1:5d}] loss: {running_loss / 2000:.3f}')
186185
running_loss = 0.0
187186

188187
print('Finished Training')
@@ -213,7 +212,7 @@ def forward(self, x):
213212

214213
# ์ด๋ฏธ์ง€๋ฅผ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.
215214
imshow(torchvision.utils.make_grid(images))
216-
print('GroundTruth: ', ' '.join('%5s' % classes[labels[j]] for j in range(4)))
215+
print('GroundTruth: ', ' '.join(f'{classes[labels[j]]:5s}' for j in range(4)))
217216

218217
########################################################################
219218
# ์ด์ œ, ์ €์žฅํ–ˆ๋˜ ๋ชจ๋ธ์„ ๋ถˆ๋Ÿฌ์˜ค๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค (์ฃผ: ๋ชจ๋ธ์„ ์ €์žฅํ•˜๊ณ  ๋‹ค์‹œ ๋ถˆ๋Ÿฌ์˜ค๋Š”
@@ -233,7 +232,7 @@ def forward(self, x):
233232
# ๋”ฐ๋ผ์„œ, ๊ฐ€์žฅ ๋†’์€ ๊ฐ’์„ ๊ฐ–๋Š” ์ธ๋ฑ์Šค(index)๋ฅผ ๋ฝ‘์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค:
234233
_, predicted = torch.max(outputs, 1)
235234

236-
print('Predicted: ', ' '.join('%5s' % classes[predicted[j]]
235+
print('Predicted: ', ' '.join(f'{classes[predicted[j]]:5s}'
237236
for j in range(4)))
238237

239238
########################################################################
@@ -254,8 +253,7 @@ def forward(self, x):
254253
total += labels.size(0)
255254
correct += (predicted == labels).sum().item()
256255

257-
print('Accuracy of the network on the 10000 test images: %d %%' % (
258-
100 * correct / total))
256+
print(f'Accuracy of the network on the 10000 test images: {100 * correct // total} %')
259257

260258
########################################################################
261259
# (10๊ฐ€์ง€ ๋ถ„๋ฅ˜ ์ค‘์— ํ•˜๋‚˜๋ฅผ ๋ฌด์ž‘์œ„๋กœ) ์ฐ์—ˆ์„ ๋•Œ์˜ ์ •ํ™•๋„์ธ 10% ๋ณด๋‹ค๋Š” ๋‚˜์•„๋ณด์ž…๋‹ˆ๋‹ค.
@@ -283,8 +281,7 @@ def forward(self, x):
283281
# ๊ฐ ๋ถ„๋ฅ˜๋ณ„ ์ •ํ™•๋„(accuracy)๋ฅผ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค
284282
for classname, correct_count in correct_pred.items():
285283
accuracy = 100 * float(correct_count) / total_pred[classname]
286-
print("Accuracy for class {:5s} is: {:.1f} %".format(classname,
287-
accuracy))
284+
print(f'Accuracy for class: {classname:5s} is {accuracy:.1f} %')
288285

289286
########################################################################
290287
# ์ž, ์ด์ œ ๋‹ค์Œ์œผ๋กœ ๋ฌด์—‡์„ ํ•ด๋ณผ๊นŒ์š”?
@@ -297,7 +294,7 @@ def forward(self, x):
297294
#
298295
# ๋จผ์ € (CUDA๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค๋ฉด) ์ฒซ๋ฒˆ์งธ CUDA ์žฅ์น˜๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค:
299296

300-
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
297+
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
301298

302299
# CUDA ๊ธฐ๊ธฐ๊ฐ€ ์กด์žฌํ•œ๋‹ค๋ฉด, ์•„๋ž˜ ์ฝ”๋“œ๊ฐ€ CUDA ์žฅ์น˜๋ฅผ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค:
303300

โ€Žbeginner_source/data_loading_tutorial.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@
6262
# 0805personali01.jpg,27,83,27,98, ... 84,134
6363
# 1084239450_e76e00b7e7.jpg,70,236,71,257, ... ,128,312
6464
#
65-
# ์ด์ œ CSV ํŒŒ์ผ์„ ๋ถˆ๋Ÿฌ์™€์„œ (N, 2) ๋ฐฐ์—ด์•ˆ์— ์žˆ๋Š” ๋žœ๋“œ๋งˆํฌ๋“ค์„ ์žก์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.
66-
# N์€ ๋žœ๋“œ๋งˆํฌ(landmarks)์˜ ๊ฐœ์ˆ˜์ž…๋‹ˆ๋‹ค.
65+
# ์ด์ œ CSV์—์„œ ์ด๋ฏธ์ง€ ์ด๋ฆ„๊ณผ ๊ทธ์— ํ•ด๋‹นํ•˜๋Š” ๋ฐ์ดํ„ฐ(annotation)์„ ๊ฐ€์ ธ์™€ ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ์˜ˆ์‹œ๋กœ person-7.jpg๊ฐ€ ์žˆ๋Š”
66+
# 65๋ฒˆ์งธ ์ค„(row index number)์„ ๊ฐ€์ ธ์˜ค๊ฒ ์Šต๋‹ˆ๋‹ค.์ด๋ฏธ์ง€ ์ด๋ฆ„์„ ์ฝ์–ด ``img_name`` ์— ์ €์žฅํ•˜๊ณ , ๋ฐ์ดํ„ฐ๋Š” (L, 2)
67+
# ๋ฐฐ์—ด์ธ ``landmarks`` ์— ์ €์žฅํ•ฉ๋‹ˆ๋‹ค. ์ด ๋•Œ L์€ ํ•ด๋‹น ํ–‰์˜ ๋žœ๋“œ๋งˆํฌ์˜ ๊ฐœ์ˆ˜์ž…๋‹ˆ๋‹ค.
6768

6869
landmarks_frame = pd.read_csv('data/faces/face_landmarks.csv')
6970

@@ -396,6 +397,10 @@ def show_landmarks_batch(sample_batched):
396397

397398
plt.title('Batch from dataloader')
398399

400+
# Windows๋ฅผ ์‚ฌ์šฉ ์ค‘์ด๋ผ๋ฉด, ๋‹ค์Œ ์ค„์˜ ์ฃผ์„์„ ์ œ๊ฑฐํ•˜๊ณ  for ๋ฐ˜๋ณต๋ฌธ์„ ๋“ค์—ฌ์“ฐ๊ธฐํ•ฉ๋‹ˆ๋‹ค.
401+
# "num_workers"๋ฅผ 0์œผ๋กœ ๋ณ€๊ฒฝํ•ด์•ผ ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.
402+
403+
# if __name__ == '__main__':
399404
for i_batch, sample_batched in enumerate(dataloader):
400405
print(i_batch, sample_batched['image'].size(),
401406
sample_batched['landmarks'].size())

โ€Žbeginner_source/examples_nn/dynamic_net.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
---------------------------------------------------------------
55
66
PyTorch ๋™์  ๊ทธ๋ž˜ํ”„์˜ ๊ฐ•๋ ฅํ•จ์„ ๋ณด์—ฌ์ฃผ๊ธฐ ์œ„ํ•ด, ๋งค์šฐ ์ด์ƒํ•œ ๋ชจ๋ธ์„ ๊ตฌํ˜„ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค:
7-
๊ฐ ์ˆœ์ „ํŒŒ ๋‹จ๊ณ„์—์„œ 3 ~ 5 ์‚ฌ์ด์˜ ์ž„์˜์˜ ์ˆซ์ž๋ฅผ ์„ ํƒํ•˜์—ฌ ๋‹ค์ฐจํ•ญ๋“ค์—์„œ ์‚ฌ์šฉํ•˜๊ณ , ๋™์ผํ•œ ๊ฐ€์ค‘์น˜๋ฅผ ์—ฌ๋Ÿฌ๋ฒˆ
7+
๊ฐ ์ˆœ์ „ํŒŒ ๋‹จ๊ณ„์—์„œ 4 ~ 5 ์‚ฌ์ด์˜ ์ž„์˜์˜ ์ˆซ์ž๋ฅผ ์„ ํƒํ•˜์—ฌ ๋‹ค์ฐจํ•ญ๋“ค์—์„œ ์‚ฌ์šฉํ•˜๊ณ , ๋™์ผํ•œ ๊ฐ€์ค‘์น˜๋ฅผ ์—ฌ๋Ÿฌ๋ฒˆ
88
์žฌ์‚ฌ์šฉํ•˜์—ฌ 4์ฐจํ•ญ๊ณผ 5์ฐจํ•ญ์„ ๊ณ„์‚ฐํ•˜๋Š” 3-5์ฐจ ๋‹คํ•ญ์‹์ž…๋‹ˆ๋‹ค.
99
"""
1010
import random

โ€Žbeginner_source/introyt.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
`Introduction <introyt/introyt1_tutorial.html>`_ ||
2+
`Tensors <introyt/tensors_deeper_tutorial.html>`_ ||
3+
`Autograd <introyt/autogradyt_tutorial.html>`_ ||
4+
`Building Models <introyt/modelsyt_tutorial.html>`_ ||
5+
`TensorBoard Support <introyt/tensorboardyt_tutorial.html>`_ ||
6+
`Training Models <introyt/trainingyt.html>`_ ||
7+
`Model Understanding <introyt/captumyt.html>`_
8+
9+
Introduction to PyTorch - YouTube Series
10+
========================================
11+
12+
Authors:
13+
`Brad Heintz <https://github.com/fbbradheintz>`_
14+
15+
This tutorial follows along with the `PyTorch Beginner Series <https://www.youtube.com/playlist?list=PL_lsbAsL_o2CTlGHgMxNrKhzP97BaG9ZN>`_ on youtube.
16+
17+
`This tutorial assumes a basic familiarity with Python and Deep Learning concepts.`
18+
19+
Running the Tutorial Code
20+
-------------------------
21+
You can run this tutorial in a couple of ways:
22+
23+
- **In the cloud**: This is the easiest way to get started! Each section has a Colab link at the top, which opens a notebook with the code in a fully-hosted environment. Pro tip: Use Colab with a GPU runtime to speed up operations *Runtime > Change runtime type > GPU*
24+
- **Locally**: This option requires you to setup PyTorch and TorchVision first on your local machine (`installation instructions <https://pytorch.org/get-started/locally/>`_). Download the notebook or copy the code into your favorite IDE.
25+
26+
.. include:: /beginner_source/introyt/tocyt.txt
27+
28+
.. toctree::
29+
:hidden:
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Introduction to PyTorch on YouTube
2+
----------------------------------
3+
4+
1. introyt.rst
5+
Introduction to PyTorch - Youtube Series
6+
https://tutorials.pytorch.kr/beginner/introyt/introyt.html
7+
8+
2. introyt1_tutorial.py
9+
Introduction to PyTorch
10+
https://tutorials.pytorch.kr/beginner/introyt/introyt1_tutorial.html
11+
12+
3. tensors_deeper_tutorial.py
13+
PyTorch Tensors
14+
https://tutorials.pytorch.kr/beginner/introyt/tensors_deeper_tutorial.html
15+
16+
4. autogradyt_tutorial.py
17+
The Fundamentals of Autograd
18+
https://tutorials.pytorch.kr/beginner/introyt/autogradyt_tutorial.html
19+
20+
5. modelsyt_tutorial.py
21+
Building Models with PyTorch
22+
https://tutorials.pytorch.kr/beginner/introyt/modelsyt_tutorial.html
23+
24+
6. tensorboardyt_tutorial.py
25+
PyTorch TensorBoard Support
26+
https://tutorials.pytorch.kr/beginner/introyt/tensorboardyt_tutorial.html
27+
28+
7. trainingyt_tutorial.py
29+
Training with PyTorch
30+
https://tutorials.pytorch.kr/beginner/introyt/trainingyt_tutorial.html
31+
32+
8. captumyt_tutorial.py
33+
Model Understanding with Captum
34+
https://tutorials.pytorch.kr/beginner/introyt/captumyt_tutorial.html

0 commit comments

Comments
ย (0)