Skip to content

Commit dcae965

Browse files
committed
Error corrected
1 parent 8de331e commit dcae965

File tree

2 files changed

+36
-17
lines changed

2 files changed

+36
-17
lines changed

Neural_Network_Part1.ipynb

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": 2,
15+
"execution_count": 1,
1616
"metadata": {
1717
"collapsed": true,
1818
"deletable": true,
@@ -298,14 +298,20 @@
298298
},
299299
{
300300
"cell_type": "markdown",
301-
"metadata": {},
301+
"metadata": {
302+
"deletable": true,
303+
"editable": true
304+
},
302305
"source": [
303306
"# Fully Connected"
304307
]
305308
},
306309
{
307310
"cell_type": "markdown",
308-
"metadata": {},
311+
"metadata": {
312+
"deletable": true,
313+
"editable": true
314+
},
309315
"source": [
310316
"Q5. Apply a fully connected layer to x with 2 outputs and then an sigmoid function."
311317
]
@@ -314,7 +320,9 @@
314320
"cell_type": "code",
315321
"execution_count": 3,
316322
"metadata": {
317-
"collapsed": false
323+
"collapsed": false,
324+
"deletable": true,
325+
"editable": true
318326
},
319327
"outputs": [
320328
{
@@ -685,7 +693,7 @@
685693
},
686694
{
687695
"cell_type": "code",
688-
"execution_count": 20,
696+
"execution_count": 2,
689697
"metadata": {
690698
"collapsed": false,
691699
"deletable": true,
@@ -696,13 +704,13 @@
696704
"name": "stdout",
697705
"output_type": "stream",
698706
"text": [
699-
"(4, 9, 9, 5)\n"
707+
"(4, 11, 11, 5)\n"
700708
]
701709
}
702710
],
703711
"source": [
704712
"x = tf.random_uniform(shape=(4, 5, 5, 4), dtype=tf.float32)\n",
705-
"filter = tf.get_variable(\"filter\", shape=..., dtype=tf.float32, \n",
713+
"filter = tf.get_variable(\"filter\", shape=(3, 3, 5, 4), dtype=tf.float32, \n",
706714
" initializer=tf.random_uniform_initializer())\n",
707715
"shp = x.get_shape().as_list()\n",
708716
"output_shape = ...\n",

Neural_Network_Part1_Solutions.ipynb

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": 2,
15+
"execution_count": 1,
1616
"metadata": {
1717
"collapsed": true,
1818
"deletable": true,
@@ -298,14 +298,20 @@
298298
},
299299
{
300300
"cell_type": "markdown",
301-
"metadata": {},
301+
"metadata": {
302+
"deletable": true,
303+
"editable": true
304+
},
302305
"source": [
303306
"# Fully Connected"
304307
]
305308
},
306309
{
307310
"cell_type": "markdown",
308-
"metadata": {},
311+
"metadata": {
312+
"deletable": true,
313+
"editable": true
314+
},
309315
"source": [
310316
"Q5. Apply a fully connected layer to x with 2 outputs and then an sigmoid function."
311317
]
@@ -314,7 +320,9 @@
314320
"cell_type": "code",
315321
"execution_count": 24,
316322
"metadata": {
317-
"collapsed": false
323+
"collapsed": false,
324+
"deletable": true,
325+
"editable": true
318326
},
319327
"outputs": [
320328
{
@@ -453,7 +461,10 @@
453461
"with tf.Session() as sess:\n",
454462
" sess.run(init)\n",
455463
" _out = sess.run(out)\n",
456-
" print(_out.shape)"
464+
" print(_out.shape)\n",
465+
"# Do we really have to distinguish between these two functions? \n",
466+
"# Unless you want to use stride of 2 or more,\n",
467+
"# You can just use tf.nn.atrous_conv2d. For normal convolution, set rate 1."
457468
]
458469
},
459470
{
@@ -678,7 +689,7 @@
678689
},
679690
{
680691
"cell_type": "code",
681-
"execution_count": 19,
692+
"execution_count": 11,
682693
"metadata": {
683694
"collapsed": true,
684695
"deletable": true,
@@ -691,7 +702,7 @@
691702
},
692703
{
693704
"cell_type": "code",
694-
"execution_count": 20,
705+
"execution_count": 12,
695706
"metadata": {
696707
"collapsed": false,
697708
"deletable": true,
@@ -702,7 +713,7 @@
702713
"name": "stdout",
703714
"output_type": "stream",
704715
"text": [
705-
"(4, 9, 9, 5)\n"
716+
"(4, 11, 11, 5)\n"
706717
]
707718
}
708719
],
@@ -711,8 +722,8 @@
711722
"filter = tf.get_variable(\"filter\", shape=(3, 3, 5, 4), dtype=tf.float32, \n",
712723
" initializer=tf.random_uniform_initializer())\n",
713724
"shp = x.get_shape().as_list()\n",
714-
"output_shape = [shp[0], (shp[1]-1)*2+1, (shp[2]-1)*2+1, 5]\n",
715-
"out = tf.nn.conv2d_transpose(x, filter, strides=[1, 2, 2, 1], output_shape=output_shape, padding=\"SAME\")\n",
725+
"output_shape = [shp[0], (shp[1]-1)*2+3, (shp[2]-1)*2+3, 5]\n",
726+
"out = tf.nn.conv2d_transpose(x, filter, strides=[1, 2, 2, 1], output_shape=output_shape, padding=\"VALID\")\n",
716727
"init = tf.global_variables_initializer()\n",
717728
"with tf.Session() as sess:\n",
718729
" sess.run(init)\n",

0 commit comments

Comments
 (0)