Skip to content

Commit 2f89884

Browse files
committed
copy edits and matrix shape for char rnn
1 parent 4967848 commit 2f89884

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

cycle-gan/CycleGAN_Exercise.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
"def scale(x, feature_range=(-1, 1)):\n",
234234
" ''' Scale takes in an image x and returns that image, scaled\n",
235235
" with a feature_range of pixel values from -1 to 1. \n",
236-
" This function assumes that the input x is already scaled from 0-255.'''\n",
236+
" This function assumes that the input x is already scaled from 0-1.'''\n",
237237
" \n",
238238
" # scale from 0-1 to feature_range\n",
239239
" min, max = feature_range\n",
@@ -684,7 +684,7 @@
684684
" \n",
685685
"\n",
686686
"def fake_mse_loss(D_out):\n",
687-
" # how close is the produced output from being \"false\"?\n",
687+
" # how close is the produced output from being \"fake\"?\n",
688688
" \n",
689689
"\n",
690690
"def cycle_consistency_loss(real_im, reconstructed_im, lambda_weight):\n",

cycle-gan/CycleGAN_Solution.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@
263263
"def scale(x, feature_range=(-1, 1)):\n",
264264
" ''' Scale takes in an image x and returns that image, scaled\n",
265265
" with a feature_range of pixel values from -1 to 1. \n",
266-
" This function assumes that the input x is already scaled from 0-255.'''\n",
266+
" This function assumes that the input x is already scaled from 0-1.'''\n",
267267
" \n",
268268
" # scale from 0-1 to feature_range\n",
269269
" min, max = feature_range\n",
@@ -1003,7 +1003,7 @@
10031003
" return torch.mean((D_out-1)**2)\n",
10041004
"\n",
10051005
"def fake_mse_loss(D_out):\n",
1006-
" # how close is the produced output from being \"false\"?\n",
1006+
" # how close is the produced output from being \"fake\"?\n",
10071007
" return torch.mean(D_out**2)\n",
10081008
"\n",
10091009
"def cycle_consistency_loss(real_im, reconstructed_im, lambda_weight):\n",

project-tv-script-generation/dlnd_tv_script_generation.ipynb

+9-5
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
"source": [
166166
"## Pre-process all the data and save it\n",
167167
"\n",
168-
"Running the code cell below will pre-process all the data and save it to file. You're encouraged to lok at the code for `preprocess_and_save_data` in the `helpers.py` file to see what it's doing in detail, but you do not need to change this code."
168+
"Running the code cell below will pre-process all the data and save it to file. You're encouraged to look at the code for `preprocess_and_save_data` in the `helpers.py` file to see what it's doing in detail, but you do not need to change this code."
169169
]
170170
},
171171
{
@@ -345,7 +345,9 @@
345345
{
346346
"cell_type": "code",
347347
"execution_count": null,
348-
"metadata": {},
348+
"metadata": {
349+
"collapsed": true
350+
},
349351
"outputs": [],
350352
"source": [
351353
"# test dataloader\n",
@@ -902,14 +904,16 @@
902904
{
903905
"cell_type": "code",
904906
"execution_count": null,
905-
"metadata": {},
907+
"metadata": {
908+
"collapsed": true
909+
},
906910
"outputs": [],
907911
"source": []
908912
}
909913
],
910914
"metadata": {
911915
"kernelspec": {
912-
"display_name": "Python 3",
916+
"display_name": "Python [default]",
913917
"language": "python",
914918
"name": "python3"
915919
},
@@ -923,7 +927,7 @@
923927
"name": "python",
924928
"nbconvert_exporter": "python",
925929
"pygments_lexer": "ipython3",
926-
"version": "3.6.3"
930+
"version": "3.6.4"
927931
},
928932
"widgets": {
929933
"state": {},

recurrent-neural-networks/char-rnn/Character_Level_RNN_Exercise.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
"def one_hot_encode(arr, n_labels):\n",
143143
" \n",
144144
" # Initialize the the encoded array\n",
145-
" one_hot = np.zeros((np.multiply(*arr.shape), n_labels), dtype=np.float32)\n",
145+
" one_hot = np.zeros((arr.size, n_labels), dtype=np.float32)\n",
146146
" \n",
147147
" # Fill the appropriate elements with ones\n",
148148
" one_hot[np.arange(one_hot.shape[0]), arr.flatten()] = 1.\n",

recurrent-neural-networks/char-rnn/Character_Level_RNN_Solution.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
"def one_hot_encode(arr, n_labels):\n",
166166
" \n",
167167
" # Initialize the the encoded array\n",
168-
" one_hot = np.zeros((np.multiply(*arr.shape), n_labels), dtype=np.float32)\n",
168+
" one_hot = np.zeros((arr.size, n_labels), dtype=np.float32)\n",
169169
" \n",
170170
" # Fill the appropriate elements with ones\n",
171171
" one_hot[np.arange(one_hot.shape[0]), arr.flatten()] = 1.\n",

0 commit comments

Comments
 (0)