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
1e27e90e
Unverified
Commit
1e27e90e
authored
Mar 26, 2020
by
Jinjing Zhou
Committed by
GitHub
Mar 26, 2020
Browse files
[MXNet] Patch mxnet unittest (#1395)
* patch * turn off tf test * skip test * fix
parent
08fcda32
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
54 deletions
+58
-54
Jenkinsfile
Jenkinsfile
+41
-41
tests/compute/test_batched_graph.py
tests/compute/test_batched_graph.py
+6
-6
tests/compute/test_graph.py
tests/compute/test_graph.py
+4
-4
tests/compute/test_heterograph.py
tests/compute/test_heterograph.py
+1
-0
tests/compute/test_random.py
tests/compute/test_random.py
+3
-3
tests/compute/test_to_device.py
tests/compute/test_to_device.py
+3
-0
No files found.
Jenkinsfile
View file @
1e27e90e
...
@@ -203,47 +203,47 @@ pipeline {
...
@@ -203,47 +203,47 @@ pipeline {
}
}
}
}
}
}
stage
(
"Tensorflow CPU"
)
{
//
stage("Tensorflow CPU") {
agent
{
//
agent {
docker
{
//
docker {
label
"linux-cpu-node"
//
label "linux-cpu-node"
image
"dgllib/dgl-ci-cpu:conda"
//
image "dgllib/dgl-ci-cpu:conda"
}
//
}
}
//
}
stages
{
//
stages {
stage
(
"Unit test"
)
{
//
stage("Unit test") {
steps
{
//
steps {
unit_test_linux
(
"tensorflow"
,
"cpu"
)
//
unit_test_linux("tensorflow", "cpu")
}
//
}
}
//
}
}
//
}
post
{
//
post {
always
{
//
always {
cleanWs
disableDeferredWipeout:
true
,
deleteDirs:
true
//
cleanWs disableDeferredWipeout: true, deleteDirs: true
}
//
}
}
//
}
}
//
}
stage
(
"Tensorflow GPU"
)
{
//
stage("Tensorflow GPU") {
agent
{
//
agent {
docker
{
//
docker {
label
"linux-gpu-node"
//
label "linux-gpu-node"
image
"dgllib/dgl-ci-gpu:conda"
//
image "dgllib/dgl-ci-gpu:conda"
args
"--runtime nvidia"
//
args "--runtime nvidia"
}
//
}
}
//
}
stages
{
//
stages {
stage
(
"Unit test"
)
{
//
stage("Unit test") {
steps
{
//
steps {
unit_test_linux
(
"tensorflow"
,
"gpu"
)
//
unit_test_linux("tensorflow", "gpu")
}
//
}
}
//
}
}
//
}
post
{
//
post {
always
{
//
always {
cleanWs
disableDeferredWipeout:
true
,
deleteDirs:
true
//
cleanWs disableDeferredWipeout: true, deleteDirs: true
}
//
}
}
//
}
}
//
}
stage
(
"Torch CPU"
)
{
stage
(
"Torch CPU"
)
{
agent
{
agent
{
docker
{
docker
{
...
...
tests/compute/test_batched_graph.py
View file @
1e27e90e
...
@@ -130,8 +130,8 @@ def test_batch_send_then_recv():
...
@@ -130,8 +130,8 @@ def test_batch_send_then_recv():
bg
.
recv
([
1
,
9
])
# assuming recv takes in unique nodes
bg
.
recv
([
1
,
9
])
# assuming recv takes in unique nodes
t1
,
t2
=
dgl
.
unbatch
(
bg
)
t1
,
t2
=
dgl
.
unbatch
(
bg
)
assert
t1
.
ndata
[
'h'
][
1
]
==
7
assert
F
.
asnumpy
(
t1
.
ndata
[
'h'
][
1
]
)
==
7
assert
t2
.
ndata
[
'h'
][
4
]
==
2
assert
F
.
asnumpy
(
t2
.
ndata
[
'h'
][
4
]
)
==
2
def
test_batch_send_and_recv
():
def
test_batch_send_and_recv
():
t1
=
tree1
()
t1
=
tree1
()
...
@@ -146,8 +146,8 @@ def test_batch_send_and_recv():
...
@@ -146,8 +146,8 @@ def test_batch_send_and_recv():
bg
.
send_and_recv
((
u
,
v
))
bg
.
send_and_recv
((
u
,
v
))
t1
,
t2
=
dgl
.
unbatch
(
bg
)
t1
,
t2
=
dgl
.
unbatch
(
bg
)
assert
t1
.
ndata
[
'h'
][
1
]
==
7
assert
F
.
asnumpy
(
t1
.
ndata
[
'h'
][
1
]
)
==
7
assert
t2
.
ndata
[
'h'
][
4
]
==
2
assert
F
.
asnumpy
(
t2
.
ndata
[
'h'
][
4
]
)
==
2
def
test_batch_propagate
():
def
test_batch_propagate
():
t1
=
tree1
()
t1
=
tree1
()
...
@@ -173,8 +173,8 @@ def test_batch_propagate():
...
@@ -173,8 +173,8 @@ def test_batch_propagate():
bg
.
prop_edges
(
order
)
bg
.
prop_edges
(
order
)
t1
,
t2
=
dgl
.
unbatch
(
bg
)
t1
,
t2
=
dgl
.
unbatch
(
bg
)
assert
t1
.
ndata
[
'h'
][
0
]
==
9
assert
F
.
asnumpy
(
t1
.
ndata
[
'h'
][
0
]
)
==
9
assert
t2
.
ndata
[
'h'
][
1
]
==
5
assert
F
.
asnumpy
(
t2
.
ndata
[
'h'
][
1
]
)
==
5
def
test_batched_edge_ordering
():
def
test_batched_edge_ordering
():
g1
=
dgl
.
DGLGraph
()
g1
=
dgl
.
DGLGraph
()
...
...
tests/compute/test_graph.py
View file @
1e27e90e
...
@@ -358,8 +358,8 @@ def test_find_edges():
...
@@ -358,8 +358,8 @@ def test_find_edges():
g
.
add_nodes
(
10
)
g
.
add_nodes
(
10
)
g
.
add_edges
(
range
(
9
),
range
(
1
,
10
))
g
.
add_edges
(
range
(
9
),
range
(
1
,
10
))
e
=
g
.
find_edges
([
1
,
3
,
2
,
4
])
e
=
g
.
find_edges
([
1
,
3
,
2
,
4
])
assert
e
[
0
][
0
]
==
1
and
e
[
0
][
1
]
==
3
and
e
[
0
][
2
]
==
2
and
e
[
0
][
3
]
==
4
assert
F
.
asnumpy
(
e
[
0
][
0
]
)
==
1
and
F
.
asnumpy
(
e
[
0
][
1
]
)
==
3
and
F
.
asnumpy
(
e
[
0
][
2
]
)
==
2
and
F
.
asnumpy
(
e
[
0
][
3
]
)
==
4
assert
e
[
1
][
0
]
==
2
and
e
[
1
][
1
]
==
4
and
e
[
1
][
2
]
==
3
and
e
[
1
][
3
]
==
5
assert
F
.
asnumpy
(
e
[
1
][
0
]
)
==
2
and
F
.
asnumpy
(
e
[
1
][
1
]
)
==
4
and
F
.
asnumpy
(
e
[
1
][
2
]
)
==
3
and
F
.
asnumpy
(
e
[
1
][
3
]
)
==
5
try
:
try
:
g
.
find_edges
([
10
])
g
.
find_edges
([
10
])
...
@@ -371,8 +371,8 @@ def test_find_edges():
...
@@ -371,8 +371,8 @@ def test_find_edges():
g
.
readonly
()
g
.
readonly
()
e
=
g
.
find_edges
([
1
,
3
,
2
,
4
])
e
=
g
.
find_edges
([
1
,
3
,
2
,
4
])
assert
e
[
0
][
0
]
==
1
and
e
[
0
][
1
]
==
3
and
e
[
0
][
2
]
==
2
and
e
[
0
][
3
]
==
4
assert
F
.
asnumpy
(
e
[
0
][
0
]
)
==
1
and
F
.
asnumpy
(
e
[
0
][
1
]
)
==
3
and
F
.
asnumpy
(
e
[
0
][
2
]
)
==
2
and
F
.
asnumpy
(
e
[
0
][
3
]
)
==
4
assert
e
[
1
][
0
]
==
2
and
e
[
1
][
1
]
==
4
and
e
[
1
][
2
]
==
3
and
e
[
1
][
3
]
==
5
assert
F
.
asnumpy
(
e
[
1
][
0
]
)
==
2
and
F
.
asnumpy
(
e
[
1
][
1
]
)
==
4
and
F
.
asnumpy
(
e
[
1
][
2
]
)
==
3
and
F
.
asnumpy
(
e
[
1
][
3
]
)
==
5
try
:
try
:
g
.
find_edges
([
10
])
g
.
find_edges
([
10
])
...
...
tests/compute/test_heterograph.py
View file @
1e27e90e
...
@@ -711,6 +711,7 @@ def test_flatten():
...
@@ -711,6 +711,7 @@ def test_flatten():
assert
fg
.
etypes
==
[
'follows+knows'
]
assert
fg
.
etypes
==
[
'follows+knows'
]
check_mapping
(
g
,
fg
)
check_mapping
(
g
,
fg
)
@
unittest
.
skipIf
(
F
.
_default_context_str
==
'cpu'
,
reason
=
"Need gpu for this test"
)
def
test_to_device
():
def
test_to_device
():
hg
=
create_test_heterograph
()
hg
=
create_test_heterograph
()
if
F
.
is_cuda_available
():
if
F
.
is_cuda_available
():
...
...
tests/compute/test_random.py
View file @
1e27e90e
...
@@ -10,13 +10,13 @@ def test_random_choice():
...
@@ -10,13 +10,13 @@ def test_random_choice():
x
=
dgl
.
random
.
choice
(
a
,
10
,
replace
=
True
,
prob
=
None
)
x
=
dgl
.
random
.
choice
(
a
,
10
,
replace
=
True
,
prob
=
None
)
assert
len
(
x
)
==
10
assert
len
(
x
)
==
10
for
i
in
range
(
len
(
x
)):
for
i
in
range
(
len
(
x
)):
assert
x
[
i
]
>=
0
and
x
[
i
]
<
100
assert
F
.
asnumpy
(
x
[
i
]
)
>=
0
and
F
.
asnumpy
(
x
[
i
]
)
<
100
# test 2, replace=False, small num
# test 2, replace=False, small num
a
=
F
.
arange
(
0
,
100
)
a
=
F
.
arange
(
0
,
100
)
x
=
dgl
.
random
.
choice
(
a
,
10
,
replace
=
False
,
prob
=
None
)
x
=
dgl
.
random
.
choice
(
a
,
10
,
replace
=
False
,
prob
=
None
)
assert
len
(
x
)
==
10
assert
len
(
x
)
==
10
for
i
in
range
(
len
(
x
)):
for
i
in
range
(
len
(
x
)):
assert
x
[
i
]
>=
0
and
x
[
i
]
<
100
assert
F
.
asnumpy
(
x
[
i
]
)
>=
0
and
F
.
asnumpy
(
x
[
i
]
)
<
100
# test 3, replace=False, large num
# test 3, replace=False, large num
a
=
F
.
arange
(
0
,
100
)
a
=
F
.
arange
(
0
,
100
)
x
=
dgl
.
random
.
choice
(
a
,
100
,
replace
=
False
,
prob
=
None
)
x
=
dgl
.
random
.
choice
(
a
,
100
,
replace
=
False
,
prob
=
None
)
...
@@ -35,7 +35,7 @@ def test_random_choice():
...
@@ -35,7 +35,7 @@ def test_random_choice():
x
=
dgl
.
random
.
choice
(
100
,
97
,
replace
=
False
,
prob
=
prob
)
x
=
dgl
.
random
.
choice
(
100
,
97
,
replace
=
False
,
prob
=
prob
)
assert
len
(
x
)
==
97
assert
len
(
x
)
==
97
for
i
in
range
(
len
(
x
)):
for
i
in
range
(
len
(
x
)):
assert
x
[
i
]
<
37
or
x
[
i
]
>=
40
assert
F
.
asnumpy
(
x
[
i
]
)
<
37
or
F
.
asnumpy
(
x
[
i
]
)
>=
40
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
test_random_choice
()
test_random_choice
()
tests/compute/test_to_device.py
View file @
1e27e90e
import
dgl
import
dgl
import
backend
as
F
import
backend
as
F
import
unittest
@
unittest
.
skipIf
(
F
.
_default_context_str
==
'cpu'
,
reason
=
"Need gpu for this test"
)
def
test_to_device
():
def
test_to_device
():
g
=
dgl
.
DGLGraph
()
g
=
dgl
.
DGLGraph
()
g
.
add_nodes
(
5
,
{
'h'
:
F
.
ones
((
5
,
2
))})
g
.
add_nodes
(
5
,
{
'h'
:
F
.
ones
((
5
,
2
))})
...
...
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