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
e645d936
Unverified
Commit
e645d936
authored
Oct 28, 2023
by
Mingbang Wang
Committed by
GitHub
Oct 28, 2023
Browse files
[Misc] polish the python code (#6499)
parent
a93b6fec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
python/dgl/graphbolt/dataset.py
python/dgl/graphbolt/dataset.py
+3
-3
python/dgl/graphbolt/item_sampler.py
python/dgl/graphbolt/item_sampler.py
+5
-5
python/dgl/graphbolt/subgraph_sampler.py
python/dgl/graphbolt/subgraph_sampler.py
+2
-2
No files found.
python/dgl/graphbolt/dataset.py
View file @
e645d936
...
@@ -32,17 +32,17 @@ class Task:
...
@@ -32,17 +32,17 @@ class Task:
raise
NotImplementedError
raise
NotImplementedError
@
property
@
property
def
train_set
(
self
)
->
ItemSet
or
ItemSetDict
:
def
train_set
(
self
)
->
Union
[
ItemSet
,
ItemSetDict
]
:
"""Return the training set."""
"""Return the training set."""
raise
NotImplementedError
raise
NotImplementedError
@
property
@
property
def
validation_set
(
self
)
->
ItemSet
or
ItemSetDict
:
def
validation_set
(
self
)
->
Union
[
ItemSet
,
ItemSetDict
]
:
"""Return the validation set."""
"""Return the validation set."""
raise
NotImplementedError
raise
NotImplementedError
@
property
@
property
def
test_set
(
self
)
->
ItemSet
or
ItemSetDict
:
def
test_set
(
self
)
->
Union
[
ItemSet
,
ItemSetDict
]
:
"""Return the test set."""
"""Return the test set."""
raise
NotImplementedError
raise
NotImplementedError
...
...
python/dgl/graphbolt/item_sampler.py
View file @
e645d936
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
from
collections.abc
import
Mapping
from
collections.abc
import
Mapping
from
functools
import
partial
from
functools
import
partial
from
typing
import
Callable
,
Iterator
,
Optional
from
typing
import
Callable
,
Iterator
,
Optional
,
Union
import
numpy
as
np
import
numpy
as
np
import
torch
import
torch
...
@@ -200,7 +200,7 @@ class ItemSampler(IterDataPipe):
...
@@ -200,7 +200,7 @@ class ItemSampler(IterDataPipe):
Parameters
Parameters
----------
----------
item_set : ItemSet
or
ItemSetDict
item_set :
Union[
ItemSet
,
ItemSetDict
]
Data to be sampled.
Data to be sampled.
batch_size : int
batch_size : int
The size of each batch.
The size of each batch.
...
@@ -391,7 +391,7 @@ class ItemSampler(IterDataPipe):
...
@@ -391,7 +391,7 @@ class ItemSampler(IterDataPipe):
def
__init__
(
def
__init__
(
self
,
self
,
item_set
:
ItemSet
or
ItemSetDict
,
item_set
:
Union
[
ItemSet
,
ItemSetDict
]
,
batch_size
:
int
,
batch_size
:
int
,
minibatcher
:
Optional
[
Callable
]
=
minibatcher_default
,
minibatcher
:
Optional
[
Callable
]
=
minibatcher_default
,
drop_last
:
Optional
[
bool
]
=
False
,
drop_last
:
Optional
[
bool
]
=
False
,
...
@@ -501,7 +501,7 @@ class DistributedItemSampler(ItemSampler):
...
@@ -501,7 +501,7 @@ class DistributedItemSampler(ItemSampler):
Parameters
Parameters
----------
----------
item_set : ItemSet
or
ItemSetDict
item_set :
Union[
ItemSet
,
ItemSetDict
]
Data to be sampled.
Data to be sampled.
batch_size : int
batch_size : int
The size of each batch.
The size of each batch.
...
@@ -627,7 +627,7 @@ class DistributedItemSampler(ItemSampler):
...
@@ -627,7 +627,7 @@ class DistributedItemSampler(ItemSampler):
def
__init__
(
def
__init__
(
self
,
self
,
item_set
:
ItemSet
or
ItemSetDict
,
item_set
:
Union
[
ItemSet
,
ItemSetDict
]
,
batch_size
:
int
,
batch_size
:
int
,
minibatcher
:
Optional
[
Callable
]
=
minibatcher_default
,
minibatcher
:
Optional
[
Callable
]
=
minibatcher_default
,
drop_last
:
Optional
[
bool
]
=
False
,
drop_last
:
Optional
[
bool
]
=
False
,
...
...
python/dgl/graphbolt/subgraph_sampler.py
View file @
e645d936
...
@@ -45,8 +45,8 @@ class SubgraphSampler(MiniBatchTransformer):
...
@@ -45,8 +45,8 @@ class SubgraphSampler(MiniBatchTransformer):
seeds
=
minibatch
.
seed_nodes
seeds
=
minibatch
.
seed_nodes
else
:
else
:
raise
ValueError
(
raise
ValueError
(
f
"Invalid minibatch
{
minibatch
}
: Either
'
node_pairs
'
or
\
f
"Invalid minibatch
{
minibatch
}
: Either
`
node_pairs
`
or
"
'
seed_nodes
'
should have a value."
"`
seed_nodes
`
should have a value."
)
)
(
(
minibatch
.
input_nodes
,
minibatch
.
input_nodes
,
...
...
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