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
c99f4237
Commit
c99f4237
authored
Dec 04, 2018
by
Da Zheng
Committed by
Minjie Wang
Dec 04, 2018
Browse files
[Sampler] extend sampler (#238)
parent
455ea485
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
python/dgl/backend/mxnet/immutable_graph_index.py
python/dgl/backend/mxnet/immutable_graph_index.py
+8
-4
No files found.
python/dgl/backend/mxnet/immutable_graph_index.py
View file @
c99f4237
...
...
@@ -271,7 +271,6 @@ class ImmutableGraphIndex(object):
def
neighbor_sampling
(
self
,
seed_ids
,
expand_factor
,
num_hops
,
neighbor_type
,
node_prob
,
max_subgraph_size
):
assert
node_prob
is
None
if
neighbor_type
==
'in'
:
g
=
self
.
_in_csr
elif
neighbor_type
==
'out'
:
...
...
@@ -280,9 +279,14 @@ class ImmutableGraphIndex(object):
raise
NotImplementedError
num_nodes
=
[]
num_subgs
=
len
(
seed_ids
)
res
=
mx
.
nd
.
contrib
.
dgl_csr_neighbor_uniform_sample
(
g
,
*
seed_ids
,
num_hops
=
num_hops
,
num_neighbor
=
expand_factor
,
max_num_vertices
=
max_subgraph_size
)
if
node_prob
is
None
:
res
=
mx
.
nd
.
contrib
.
dgl_csr_neighbor_uniform_sample
(
g
,
*
seed_ids
,
num_hops
=
num_hops
,
num_neighbor
=
expand_factor
,
max_num_vertices
=
max_subgraph_size
)
else
:
res
=
mx
.
nd
.
contrib
.
dgl_csr_neighbor_non_uniform_sample
(
g
,
node_prob
,
*
seed_ids
,
num_hops
=
num_hops
,
num_neighbor
=
expand_factor
,
max_num_vertices
=
max_subgraph_size
)
vertices
,
subgraphs
=
res
[
0
:
num_subgs
],
res
[
num_subgs
:(
2
*
num_subgs
)]
num_nodes
=
[
subg_v
[
-
1
].
asnumpy
()[
0
]
for
subg_v
in
vertices
]
...
...
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