Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Fairseq
Commits
f1d81db8
"src/vscode:/vscode.git/clone" did not exist on "dd07b19e27b737d844f62a8107228591f8d7bca8"
Commit
f1d81db8
authored
Aug 09, 2018
by
alexeib
Committed by
Myle Ott
Sep 03, 2018
Browse files
fix tests
parent
97a6b139
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
tests/test_character_token_embedder.py
tests/test_character_token_embedder.py
+8
-4
No files found.
tests/test_character_token_embedder.py
View file @
f1d81db8
...
...
@@ -31,14 +31,18 @@ class TestCharacterTokenEmbedder(unittest.TestCase):
embs
=
embedder
(
input
)
assert
embs
.
size
()
==
(
len
(
test_sents
),
max_len
+
2
,
5
)
assert
embs
[
0
][
0
]
.
equal
(
embs
[
1
][
0
])
assert
embs
[
0
][
0
]
.
equal
(
embs
[
0
][
-
1
])
assert
embs
[
0
][
1
]
.
equal
(
embs
[
2
][
1
])
assert
embs
[
0
][
3
]
.
equal
(
embs
[
1
][
1
])
self
.
assert
AlmostEqual
(
embs
[
0
][
0
]
,
embs
[
1
][
0
])
self
.
assert
AlmostEqual
(
embs
[
0
][
0
]
,
embs
[
0
][
-
1
])
self
.
assert
AlmostEqual
(
embs
[
0
][
1
]
,
embs
[
2
][
1
])
self
.
assert
AlmostEqual
(
embs
[
0
][
3
]
,
embs
[
1
][
1
])
embs
.
sum
().
backward
()
assert
embedder
.
char_embeddings
.
weight
.
grad
is
not
None
def
assertAlmostEqual
(
self
,
t1
,
t2
):
self
.
assertEqual
(
t1
.
size
(),
t2
.
size
(),
"size mismatch"
)
self
.
assertLess
((
t1
-
t2
).
abs
().
max
(),
1e-6
)
if
__name__
==
'__main__'
:
unittest
.
main
()
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