-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
Conversation
import sys | ||
sys.path.insert(0, '../../..') | ||
import d2l | ||
#import d2lzh as d2l |
There was a problem hiding this comment.
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)) | ||
|
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
No description provided.