Skip to content

Commit 0acb97a

Browse files
committed
fix typo in instructions
1 parent 5003349 commit 0acb97a

File tree

2 files changed

+79
-30
lines changed

2 files changed

+79
-30
lines changed

intro-to-pytorch/Part 2 - Neural Networks in PyTorch (Exercises).ipynb

Lines changed: 58 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
{
1313
"cell_type": "code",
1414
"execution_count": null,
15-
"metadata": {},
15+
"metadata": {
16+
"collapsed": true
17+
},
1618
"outputs": [],
1719
"source": [
1820
"# Import necessary packages\n",
@@ -45,7 +47,9 @@
4547
{
4648
"cell_type": "code",
4749
"execution_count": null,
48-
"metadata": {},
50+
"metadata": {
51+
"collapsed": true
52+
},
4953
"outputs": [],
5054
"source": [
5155
"### Run this cell\n",
@@ -79,7 +83,9 @@
7983
{
8084
"cell_type": "code",
8185
"execution_count": null,
82-
"metadata": {},
86+
"metadata": {
87+
"collapsed": true
88+
},
8389
"outputs": [],
8490
"source": [
8591
"dataiter = iter(trainloader)\n",
@@ -99,7 +105,9 @@
99105
{
100106
"cell_type": "code",
101107
"execution_count": null,
102-
"metadata": {},
108+
"metadata": {
109+
"collapsed": true
110+
},
103111
"outputs": [],
104112
"source": [
105113
"plt.imshow(images[1].numpy().squeeze(), cmap='Greys_r');"
@@ -121,7 +129,9 @@
121129
{
122130
"cell_type": "code",
123131
"execution_count": null,
124-
"metadata": {},
132+
"metadata": {
133+
"collapsed": true
134+
},
125135
"outputs": [],
126136
"source": [
127137
"## Your solution\n",
@@ -153,7 +163,9 @@
153163
{
154164
"cell_type": "code",
155165
"execution_count": null,
156-
"metadata": {},
166+
"metadata": {
167+
"collapsed": true
168+
},
157169
"outputs": [],
158170
"source": [
159171
"def softmax(x):\n",
@@ -180,7 +192,9 @@
180192
{
181193
"cell_type": "code",
182194
"execution_count": null,
183-
"metadata": {},
195+
"metadata": {
196+
"collapsed": true
197+
},
184198
"outputs": [],
185199
"source": [
186200
"from torch import nn"
@@ -189,7 +203,9 @@
189203
{
190204
"cell_type": "code",
191205
"execution_count": null,
192-
"metadata": {},
206+
"metadata": {
207+
"collapsed": true
208+
},
193209
"outputs": [],
194210
"source": [
195211
"class Network(nn.Module):\n",
@@ -231,7 +247,7 @@
231247
"self.hidden = nn.Linear(784, 256)\n",
232248
"```\n",
233249
"\n",
234-
"This line creates a module for a linear transformation, $x\\mathbf{W} + b$, with 784 inputs and 256 outputs and assigns it to `self.hidden`. The module automatically creates the weight and bias tensors which we'll use in the `forward` method. You can access the weight and bias tensors once the network once it's create at `net.hidden.weight` and `net.hidden.bias`.\n",
250+
"This line creates a module for a linear transformation, $x\\mathbf{W} + b$, with 784 inputs and 256 outputs and assigns it to `self.hidden`. The module automatically creates the weight and bias tensors which we'll use in the `forward` method. You can access the weight and bias tensors once the network (`net`) is created with `net.hidden.weight` and `net.hidden.bias`.\n",
235251
"\n",
236252
"```python\n",
237253
"self.output = nn.Linear(256, 10)\n",
@@ -267,7 +283,9 @@
267283
{
268284
"cell_type": "code",
269285
"execution_count": null,
270-
"metadata": {},
286+
"metadata": {
287+
"collapsed": true
288+
},
271289
"outputs": [],
272290
"source": [
273291
"# Create the network and look at it's text representation\n",
@@ -285,7 +303,9 @@
285303
{
286304
"cell_type": "code",
287305
"execution_count": null,
288-
"metadata": {},
306+
"metadata": {
307+
"collapsed": true
308+
},
289309
"outputs": [],
290310
"source": [
291311
"import torch.nn.functional as F\n",
@@ -335,6 +355,7 @@
335355
"cell_type": "code",
336356
"execution_count": null,
337357
"metadata": {
358+
"collapsed": true,
338359
"scrolled": true
339360
},
340361
"outputs": [],
@@ -354,7 +375,9 @@
354375
{
355376
"cell_type": "code",
356377
"execution_count": null,
357-
"metadata": {},
378+
"metadata": {
379+
"collapsed": true
380+
},
358381
"outputs": [],
359382
"source": [
360383
"print(model.fc1.weight)\n",
@@ -371,7 +394,9 @@
371394
{
372395
"cell_type": "code",
373396
"execution_count": null,
374-
"metadata": {},
397+
"metadata": {
398+
"collapsed": true
399+
},
375400
"outputs": [],
376401
"source": [
377402
"# Set biases to all zeros\n",
@@ -381,7 +406,9 @@
381406
{
382407
"cell_type": "code",
383408
"execution_count": null,
384-
"metadata": {},
409+
"metadata": {
410+
"collapsed": true
411+
},
385412
"outputs": [],
386413
"source": [
387414
"# sample from random normal with standard dev = 0.01\n",
@@ -400,7 +427,9 @@
400427
{
401428
"cell_type": "code",
402429
"execution_count": null,
403-
"metadata": {},
430+
"metadata": {
431+
"collapsed": true
432+
},
404433
"outputs": [],
405434
"source": [
406435
"# Grab some data \n",
@@ -433,7 +462,9 @@
433462
{
434463
"cell_type": "code",
435464
"execution_count": null,
436-
"metadata": {},
465+
"metadata": {
466+
"collapsed": true
467+
},
437468
"outputs": [],
438469
"source": [
439470
"# Hyperparameters for our network\n",
@@ -469,7 +500,9 @@
469500
{
470501
"cell_type": "code",
471502
"execution_count": null,
472-
"metadata": {},
503+
"metadata": {
504+
"collapsed": true
505+
},
473506
"outputs": [],
474507
"source": [
475508
"print(model[0])\n",
@@ -486,7 +519,9 @@
486519
{
487520
"cell_type": "code",
488521
"execution_count": null,
489-
"metadata": {},
522+
"metadata": {
523+
"collapsed": true
524+
},
490525
"outputs": [],
491526
"source": [
492527
"from collections import OrderedDict\n",
@@ -510,7 +545,9 @@
510545
{
511546
"cell_type": "code",
512547
"execution_count": null,
513-
"metadata": {},
548+
"metadata": {
549+
"collapsed": true
550+
},
514551
"outputs": [],
515552
"source": [
516553
"print(model[0])\n",
@@ -527,7 +564,7 @@
527564
],
528565
"metadata": {
529566
"kernelspec": {
530-
"display_name": "Python 3",
567+
"display_name": "Python [default]",
531568
"language": "python",
532569
"name": "python3"
533570
},
@@ -541,7 +578,7 @@
541578
"name": "python",
542579
"nbconvert_exporter": "python",
543580
"pygments_lexer": "ipython3",
544-
"version": "3.6.6"
581+
"version": "3.6.4"
545582
}
546583
},
547584
"nbformat": 4,

intro-to-pytorch/Part 2 - Neural Networks in PyTorch (Solution).ipynb

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
{
1313
"cell_type": "code",
1414
"execution_count": 1,
15-
"metadata": {},
15+
"metadata": {
16+
"collapsed": true
17+
},
1618
"outputs": [],
1719
"source": [
1820
"# Import necessary packages\n",
@@ -45,7 +47,9 @@
4547
{
4648
"cell_type": "code",
4749
"execution_count": 2,
48-
"metadata": {},
50+
"metadata": {
51+
"collapsed": true
52+
},
4953
"outputs": [],
5054
"source": [
5155
"### Run this cell\n",
@@ -147,7 +151,9 @@
147151
{
148152
"cell_type": "code",
149153
"execution_count": 5,
150-
"metadata": {},
154+
"metadata": {
155+
"collapsed": true
156+
},
151157
"outputs": [],
152158
"source": [
153159
"## Solution\n",
@@ -237,7 +243,9 @@
237243
{
238244
"cell_type": "code",
239245
"execution_count": 7,
240-
"metadata": {},
246+
"metadata": {
247+
"collapsed": true
248+
},
241249
"outputs": [],
242250
"source": [
243251
"from torch import nn"
@@ -246,7 +254,9 @@
246254
{
247255
"cell_type": "code",
248256
"execution_count": 8,
249-
"metadata": {},
257+
"metadata": {
258+
"collapsed": true
259+
},
250260
"outputs": [],
251261
"source": [
252262
"class Network(nn.Module):\n",
@@ -288,7 +298,7 @@
288298
"self.hidden = nn.Linear(784, 256)\n",
289299
"```\n",
290300
"\n",
291-
"This line creates a module for a linear transformation, $x\\mathbf{W} + b$, with 784 inputs and 256 outputs and assigns it to `self.hidden`. The module automatically creates the weight and bias tensors which we'll use in the `forward` method. You can access the weight and bias tensors once the network once it's create at `net.hidden.weight` and `net.hidden.bias`.\n",
301+
"This line creates a module for a linear transformation, $x\\mathbf{W} + b$, with 784 inputs and 256 outputs and assigns it to `self.hidden`. The module automatically creates the weight and bias tensors which we'll use in the `forward` method. You can access the weight and bias tensors once the network (`net`) is created with `net.hidden.weight` and `net.hidden.bias`.\n",
292302
"\n",
293303
"```python\n",
294304
"self.output = nn.Linear(256, 10)\n",
@@ -358,7 +368,9 @@
358368
{
359369
"cell_type": "code",
360370
"execution_count": 10,
361-
"metadata": {},
371+
"metadata": {
372+
"collapsed": true
373+
},
362374
"outputs": [],
363375
"source": [
364376
"import torch.nn.functional as F\n",
@@ -829,7 +841,7 @@
829841
],
830842
"metadata": {
831843
"kernelspec": {
832-
"display_name": "Python 3",
844+
"display_name": "Python [default]",
833845
"language": "python",
834846
"name": "python3"
835847
},
@@ -843,7 +855,7 @@
843855
"name": "python",
844856
"nbconvert_exporter": "python",
845857
"pygments_lexer": "ipython3",
846-
"version": "3.6.6"
858+
"version": "3.6.4"
847859
}
848860
},
849861
"nbformat": 4,

0 commit comments

Comments
 (0)