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
dgl
Commits
70ee4b5e
Unverified
Commit
70ee4b5e
authored
Oct 21, 2019
by
Chao Ma
Committed by
GitHub
Oct 21, 2019
Browse files
Add more test to kvstore (#944)
parent
ff9f67ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
tests/compute/test_kvstore.py
tests/compute/test_kvstore.py
+25
-0
No files found.
tests/compute/test_kvstore.py
View file @
70ee4b5e
...
@@ -68,6 +68,31 @@ def start_client():
...
@@ -68,6 +68,31 @@ def start_client():
assert
torch
.
equal
(
new_tensor_2
,
target_tensor
)
==
True
assert
torch
.
equal
(
new_tensor_2
,
target_tensor
)
==
True
client
.
push_all
(
'embed_0'
,
client
.
pull_all
(
'embed_0'
))
client
.
push_all
(
'embed_1'
,
client
.
pull_all
(
'embed_1'
))
client
.
push_all
(
'embed_2'
,
client
.
pull_all
(
'embed_2'
))
# Pull
tensor_id
=
torch
.
tensor
([
0
,
1
,
2
,
6
,
7
,
8
])
new_tensor_0
=
client
.
pull
(
'embed_0'
,
tensor_id
)
new_tensor_1
=
client
.
pull
(
'embed_1'
,
tensor_id
)
new_tensor_2
=
client
.
pull
(
'embed_2'
,
tensor_id
)
target_tensor
=
torch
.
tensor
(
[[
0.
,
0.
,
0.
],
[
10.
,
10.
,
10.
],
[
20.
,
20.
,
20.
],
[
0.
,
0.
,
0.
],
[
10.
,
10.
,
10.
],
[
20.
,
20.
,
20.
]])
assert
torch
.
equal
(
new_tensor_0
,
target_tensor
)
==
True
assert
torch
.
equal
(
new_tensor_1
,
target_tensor
)
==
True
target_tensor
=
tensor
.
tensor
([
20.
,
20.
,
20.
,
30.
,
30.
,
30.
])
assert
torch
.
equal
(
new_tensor_2
,
target_tensor
)
==
True
client
.
shut_down
()
client
.
shut_down
()
if
__name__
==
'__main__'
:
if
__name__
==
'__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