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
chenpangpang
transformers
Commits
b64cc63a
"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "27a7fe7a8d3e58d1df7ecc4c5390ac7be728724f"
Commit
b64cc63a
authored
Apr 03, 2019
by
lukovnikov
Browse files
optimization schedule test update
parent
d164867d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
tests/optimization_test.py
tests/optimization_test.py
+9
-2
No files found.
tests/optimization_test.py
View file @
b64cc63a
...
...
@@ -51,11 +51,18 @@ class OptimizationTest(unittest.TestCase):
class
WarmupCosineWithRestartsTest
(
unittest
.
TestCase
):
def
test_it
(
self
):
m
=
WarmupCosineWithWarmupRestartsSchedule
(
warmup
=
0.05
,
t_total
=
1
,
cycles
=
3
)
m
=
WarmupCosineWithWarmupRestartsSchedule
(
warmup
=
0.05
,
t_total
=
1
,
cycles
=
5
)
x
=
np
.
arange
(
0
,
1000
)
/
1000
y
=
[
m
.
get_lr_
(
xe
)
for
xe
in
x
]
plt
.
plot
(
y
)
plt
.
show
()
plt
.
show
(
block
=
False
)
y
=
np
.
asarray
(
y
)
expected_zeros
=
y
[[
0
,
200
,
400
,
600
,
800
]]
print
(
expected_zeros
)
expected_ones
=
y
[[
50
,
250
,
450
,
650
,
850
]]
print
(
expected_ones
)
self
.
assertTrue
(
np
.
allclose
(
expected_ones
,
1
))
self
.
assertTrue
(
np
.
allclose
(
expected_zeros
,
0
))
...
...
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