Skip to content

Commit 29f5b4f

Browse files
author
xyliao
committed
fix word embedding bug
1 parent 9defba8 commit 29f5b4f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

chapter5_RNN/nlp/word-embedding.ipynb

+5-5
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@
2828
"source": [
2929
"我们举一个例子,下面有 4 段话\n",
3030
"\n",
31-
"1. The cat likes playing ball.\n",
31+
"1. The cat likes playing wool.\n",
3232
"\n",
3333
"2. The kitty likes playing wool.\n",
3434
"\n",
3535
"3. The dog likes playing ball.\n",
3636
"\n",
37-
"4. The body likes playing ball.\n",
37+
"4. The boy does not like playing ball or wool.\n",
3838
"\n",
39-
"这里面有 4 个词,分别是 cat, kitty, dog 和 boy。下面我们使用一个二维的词向量 (a, b) 来表示每一个词,其中 a,b 分别代表着这个词的一种属性,比如 a 代表是否喜欢玩飞盘,b 代表是否喜欢玩毛线,数值越大表示越喜欢,那么我们就能够用数值来定义每一个单词。\n",
39+
"这里面有 4 个词,分别是 cat, kitty, dog 和 boy。下面我们使用一个二维的词向量 (a, b) 来表示每一个词,其中 a,b 分别代表着这个词的一种属性,比如 a 代表是否喜欢玩球,b 代表是否喜欢玩毛线,数值越大表示越喜欢,那么我们就能够用数值来定义每一个单词。\n",
4040
"\n",
41-
"对于 cat,我们可以定义它的词嵌入为 (-1, 4),因为他不喜欢玩飞盘,喜欢玩毛线,同时可以定义 kitty 为 (-2, 5),dog 为 (3, 2) 以及 boy 为 (-2, -3),那么把这四个向量在坐标系中表示出来,就是\n",
41+
"对于 cat,我们可以定义它的词嵌入为 (-1, 4),因为他不喜欢玩球,喜欢玩毛线,同时可以定义 kitty 为 (-2, 5),dog 为 (3, 2) 以及 boy 为 (-2, -3),那么把这四个向量在坐标系中表示出来,就是\n",
4242
"\n",
43-
"![](https://ws1.sinaimg.cn/large/006tNc79gy1fmwf2jxhbzj30g40b2my2.jpg)"
43+
"<img src=\"https://ws1.sinaimg.cn/large/006tNc79gy1fmwf2jxhbzj30g40b2my2.jpg\" width=\"350\">"
4444
]
4545
},
4646
{

chapter6_GAN/gan.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@
12001200
" logits_real = D_net(real_data) # 判别网络得分\n",
12011201
" \n",
12021202
" sample_noise = (torch.rand(bs, noise_size) - 0.5) / 0.5 # -1 ~ 1 的均匀分布\n",
1203-
" g_fake_seed = Variable(sample_noise).cuda(1)\n",
1203+
" g_fake_seed = Variable(sample_noise).cuda()\n",
12041204
" fake_images = G_net(g_fake_seed) # 生成的假的数据\n",
12051205
" logits_fake = D_net(fake_images) # 判别网络得分\n",
12061206
"\n",
@@ -1423,7 +1423,7 @@
14231423
"name": "python",
14241424
"nbconvert_exporter": "python",
14251425
"pygments_lexer": "ipython3",
1426-
"version": "3.6.2"
1426+
"version": "3.6.3"
14271427
}
14281428
},
14291429
"nbformat": 4,

0 commit comments

Comments
 (0)