Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
ml2_MiniAssignments
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
20200318029
ml2_MiniAssignments
Commits
dae1ac87
Commit
dae1ac87
authored
Sep 09, 2020
by
20200318029
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
homework5
parent
6fcc50c5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
homework5/transformer_nmt_student.ipynb
+1
-1
homework5/transformer_nmt_student.py
+1
-1
No files found.
homework5/transformer_nmt_student.ipynb
View file @
dae1ac87
...
...
@@ -1038,7 +1038,7 @@
" # Self-Attention:注意self-attention的q,k和v均为decoder hidden\n",
" x = self.sublayer[0](x, lambda x: self.self_attn(x, x, x, tgt_mask))\n",
" # Context-Attention:注意context-attention的q为decoder hidden,而k和v为encoder hidden\n",
" x = self.sublayer[1](x, lambda x: self.s
elf
_attn(x, m, m, src_mask))\n",
" x = self.sublayer[1](x, lambda x: self.s
rc
_attn(x, m, m, src_mask))\n",
" return self.sublayer[2](x, self.feed_forward)"
]
},
...
...
homework5/transformer_nmt_student.py
View file @
dae1ac87
...
...
@@ -742,7 +742,7 @@ class DecoderLayer(nn.Module):
# Self-Attention:注意self-attention的q,k和v均为decoder hidden
x
=
self
.
sublayer
[
0
](
x
,
lambda
x
:
self
.
self_attn
(
x
,
x
,
x
,
tgt_mask
))
# Context-Attention:注意context-attention的q为decoder hidden,而k和v为encoder hidden
x
=
self
.
sublayer
[
1
](
x
,
lambda
x
:
self
.
s
elf
_attn
(
x
,
m
,
m
,
src_mask
))
x
=
self
.
sublayer
[
1
](
x
,
lambda
x
:
self
.
s
rc
_attn
(
x
,
m
,
m
,
src_mask
))
return
self
.
sublayer
[
2
](
x
,
self
.
feed_forward
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment