Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Natural Language Understanding #536

Merged
merged 13 commits into from
Dec 10, 2019
Merged

Natural Language Understanding #536

merged 13 commits into from
Dec 10, 2019

Conversation

xiaotinghe
Copy link
Contributor

No description provided.

import sys
sys.path.insert(0, '../../..')
import d2l
#import d2lzh as d2l
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use line 13 instead

# 拼接每一个词和其对齐词表示,并通过前馈神经网络
v1 = self.g(np.concatenate([a, beta], axis=2))
v2 = self.g(np.concatenate([b, alpha], axis=2))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm line

def forward(self, a, b):
# 分别将两个句子通过前馈神经网络,维度为(批量大小, 句子长度, 隐藏单元数目)
tilde_a = self.f(a)
tilde_b = self.f(b)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tilde_a -> f_a, tilde_b -> f_b

def split_batch_multi_input(X, y, ctx_list):
"""Split X and y into multiple devices specified by ctx"""
X = list(zip(*[gluon.utils.split_and_load(feature, ctx_list, even_split=False) for feature in X]))
return (X,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one-liner for 213-214

@astonzhang astonzhang merged commit 38ae42a into d2l-ai:master Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants