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
8059fa6f
Commit
8059fa6f
authored
Jun 12, 2019
by
Da Zheng
Committed by
Quan (Andy) Gan
Jun 12, 2019
Browse files
print errors if users sample from mutable graph. (#649)
* give warning. * fix. * update error msg.
parent
059b1a6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
python/dgl/contrib/sampling/sampler.py
python/dgl/contrib/sampling/sampler.py
+8
-0
No files found.
python/dgl/contrib/sampling/sampler.py
View file @
8059fa6f
...
...
@@ -230,6 +230,8 @@ class NeighborSampler(NodeFlowSampler):
``len(seed_nodes) // batch_size`` (if ``seed_nodes`` is None, then it is equal
to the set of all nodes in the graph).
Note: NeighborSampler currently only supprts immutable graphs.
Parameters
----------
g : DGLGraph
...
...
@@ -296,6 +298,8 @@ class NeighborSampler(NodeFlowSampler):
g
,
batch_size
,
seed_nodes
,
shuffle
,
num_workers
*
2
if
prefetch
else
0
,
ThreadPrefetchingWrapper
)
assert
g
.
is_readonly
,
"NeighborSampler doesn't support mutable graphs. "
+
\
"Please turn it into an immutable graph with DGLGraph.readonly"
assert
node_prob
is
None
,
'non-uniform node probability not supported'
assert
isinstance
(
expand_factor
,
Integral
),
'non-int expand_factor not supported'
...
...
@@ -330,6 +334,8 @@ class LayerSampler(NodeFlowSampler):
The NodeFlow loader returns a list of NodeFlows.
The size of the NodeFlow list is the number of workers.
Note: LayerSampler currently only supprts immutable graphs.
Parameters
----------
g : DGLGraph
...
...
@@ -380,6 +386,8 @@ class LayerSampler(NodeFlowSampler):
g
,
batch_size
,
seed_nodes
,
shuffle
,
num_workers
*
2
if
prefetch
else
0
,
ThreadPrefetchingWrapper
)
assert
g
.
is_readonly
,
"LayerSampler doesn't support mutable graphs. "
+
\
"Please turn it into an immutable graph with DGLGraph.readonly"
assert
node_prob
is
None
,
'non-uniform node probability not supported'
self
.
_num_workers
=
int
(
num_workers
)
...
...
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