Skip to content

Commit 571821e

Browse files
author
sayankotor
committed
commit
1 parent 247f7a3 commit 571821e

File tree

1 file changed

+83
-70
lines changed

1 file changed

+83
-70
lines changed

seminar03-conv_nets/how_to_shoot_yourself_in_the_foot_with_cnn.ipynb

Lines changed: 83 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,49 @@
33
"nbformat_minor": 0,
44
"metadata": {
55
"kernelspec": {
6-
"display_name": "Python 3",
7-
"language": "python",
8-
"name": "python3"
6+
"name": "python3",
7+
"display_name": "Yandex DataSphere Kernel",
8+
"language": "python"
99
},
1010
"language_info": {
11+
"file_extension": ".py",
12+
"version": "3.7.7",
13+
"mimetype": "text/x-python",
1114
"codemirror_mode": {
1215
"name": "ipython",
1316
"version": 3
1417
},
15-
"file_extension": ".py",
16-
"mimetype": "text/x-python",
1718
"name": "python",
1819
"nbconvert_exporter": "python",
19-
"pygments_lexer": "ipython3",
20-
"version": "3.6.4"
20+
"pygments_lexer": "ipython3"
2121
},
2222
"colab": {
23-
"name": "how_to_shoot_yourself_in_the_foot_with_cnn.ipynb",
23+
"name": "how_to_shoot_yourself_in_the_foot_with_cnn (4).ipynb",
2424
"provenance": []
25-
}
25+
},
26+
"notebookId": "8f3ba1c3-68b2-462d-8050-ac7d2972fee2"
2627
},
2728
"cells": [
2829
{
2930
"cell_type": "code",
3031
"metadata": {
3132
"id": "A9knWAIelap5",
32-
"colab_type": "code",
33-
"colab": {}
33+
"cellId": "24wzuqlj89wm4ahvxi57j",
34+
"trusted": true
3435
},
3536
"source": [
3637
"import torch, torch.nn as nn\n",
3738
"import torch.nn.functional as F\n",
38-
"from torch.autograd import Variable\n",
39-
"\n",
40-
"# a special module that converts [batch, channel, w, h] to [batch, units]\n",
41-
"class Flatten(nn.Module):\n",
42-
" def forward(self, input):\n",
43-
" return input.view(input.size(0), -1)"
39+
"from torch.autograd import Variable\n"
4440
],
45-
"execution_count": 0,
41+
"execution_count": null,
4642
"outputs": []
4743
},
4844
{
4945
"cell_type": "markdown",
5046
"metadata": {
5147
"id": "XxAOHFvglszx",
52-
"colab_type": "text"
48+
"cellId": "2w8bv2xmozhlclkrn7moo"
5349
},
5450
"source": [
5551
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/yandexdataschool/Practical_DL/blob/spring20/seminar3/how_to_shoot_yourself_in_the_foot_with_cnn.ipynb)"
@@ -59,8 +55,7 @@
5955
"cell_type": "code",
6056
"metadata": {
6157
"id": "4W6k6Bullap_",
62-
"colab_type": "code",
63-
"colab": {}
58+
"cellId": "0zngede38s1g2znau62g8d6"
6459
},
6560
"source": [
6661
"# assuming input shape [batch, 3, 64, 64]\n",
@@ -74,7 +69,7 @@
7469
" nn.Conv2d(in_channels=32, out_channels=64, kernel_size=(20,20)),\n",
7570
" nn.Conv2d(in_channels=64, out_channels=128, kernel_size=(20,20)),\n",
7671
" nn.Softmax(),\n",
77-
" Flatten(),\n",
72+
" nn.Flatten(),\n",
7873
" nn.Linear(64, 256),\n",
7974
" nn.Softmax(),\n",
8075
" nn.Linear(256, 10),\n",
@@ -83,61 +78,80 @@
8378
" \n",
8479
")\n"
8580
],
86-
"execution_count": 0,
81+
"execution_count": null,
82+
"outputs": []
83+
},
84+
{
85+
"cell_type": "code",
86+
"metadata": {
87+
"cellId": "7y09x5yxognh7glyjh1wk8",
88+
"trusted": true,
89+
"id": "c9i_Hj_ZhWIb"
90+
},
91+
"source": [
92+
"import torch, torch.nn as nn\n",
93+
"import torch.nn.functional as F\n",
94+
"from torch.autograd import Variable\n",
95+
"\n",
96+
"tensor = torch.randn((16, 3, 64, 64), dtype=torch.float)"
97+
],
98+
"execution_count": 1,
8799
"outputs": []
88100
},
89101
{
90102
"cell_type": "markdown",
91103
"metadata": {
92104
"id": "xydlW1NSlaqD",
93-
"colab_type": "text"
105+
"cellId": "5yp82sztn9m6jnzw71tvs"
94106
},
95107
"source": [
96-
"```\n",
97-
"\n",
98-
"```\n",
99-
"\n",
100-
"```\n",
101-
"\n",
102-
"```\n",
103-
"\n",
104-
"```\n",
105-
"\n",
106-
"```\n",
108+
"<br>\n",
109+
"<br>\n",
110+
"<br>\n",
111+
"<br>\n",
112+
"<br>\n",
113+
"<br>\n",
114+
"<br>\n",
115+
"<br>\n",
116+
"<br>\n",
117+
"<br>\n",
118+
"<br>\n",
119+
"<br>\n",
120+
"<br>\n",
121+
"<br>\n",
122+
"<br>\n",
123+
"<br>\n",
124+
"<br>\n",
125+
"<br>\n",
126+
"<br>\n",
127+
"<br>\n",
128+
"<br>\n",
129+
"<br>\n",
130+
"<br>\n",
131+
"<br>\n",
132+
"<br>\n",
133+
"<br>\n",
134+
"<br>\n",
135+
"<br>\n",
136+
"<br>\n",
137+
"<br>\n",
138+
"<br>\n",
139+
"<br>\n",
140+
"<br>\n",
141+
"<br>\n",
142+
"<br>\n",
143+
"<br>\n",
144+
"<br>\n",
145+
"<br>\n",
146+
"<br>\n",
147+
"<br>\n",
148+
"<br>\n",
149+
"<br>\n",
150+
"<br>\n",
151+
"<br>\n",
152+
"<br>\n",
107153
"\n",
108-
"```\n",
109154
"\n",
110-
"```\n",
111-
"\n",
112-
"```\n",
113-
"\n",
114-
"```\n",
115-
"\n",
116-
"```\n",
117-
"\n",
118-
"```\n",
119-
"\n",
120-
"```\n",
121-
"\n",
122-
"```\n",
123-
"\n",
124-
"```\n",
125-
"\n",
126-
"```\n",
127-
"\n",
128-
"```\n",
129-
"\n",
130-
"```\n",
131-
"\n",
132-
"```\n",
133-
"\n",
134-
"```\n",
135-
"\n",
136-
"```\n",
137-
"\n",
138-
"```\n",
139-
"\n",
140-
"```\n",
141155
"\n",
142156
"```\n",
143157
"\n",
@@ -168,13 +182,12 @@
168182
"cell_type": "code",
169183
"metadata": {
170184
"id": "E84fiu7ZlaqE",
171-
"colab_type": "code",
172-
"colab": {}
185+
"cellId": "uwnr6ieobyxcbccqdaz1f"
173186
},
174187
"source": [
175188
""
176189
],
177-
"execution_count": 0,
190+
"execution_count": null,
178191
"outputs": []
179192
}
180193
]

0 commit comments

Comments
 (0)