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
760426e4
Unverified
Commit
760426e4
authored
Oct 24, 2023
by
czkkkkkk
Committed by
GitHub
Oct 24, 2023
Browse files
[Graphbolt] Add pin_memory_() support for TorrchBasedFeatureStore. (#6452)
parent
02443df1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
python/dgl/graphbolt/impl/torch_based_feature_store.py
python/dgl/graphbolt/impl/torch_based_feature_store.py
+9
-0
No files found.
python/dgl/graphbolt/impl/torch_based_feature_store.py
View file @
760426e4
...
@@ -151,6 +151,10 @@ class TorchBasedFeature(Feature):
...
@@ -151,6 +151,10 @@ class TorchBasedFeature(Feature):
)
)
self
.
_tensor
[
ids
]
=
value
self
.
_tensor
[
ids
]
=
value
def
pin_memory_
(
self
):
"""In-place operation to copy the feature to pinned memory."""
self
.
_tensor
=
self
.
_tensor
.
pin_memory
()
class
TorchBasedFeatureStore
(
BasicFeatureStore
):
class
TorchBasedFeatureStore
(
BasicFeatureStore
):
r
"""A store to manage multiple pytorch based feature for access.
r
"""A store to manage multiple pytorch based feature for access.
...
@@ -205,3 +209,8 @@ class TorchBasedFeatureStore(BasicFeatureStore):
...
@@ -205,3 +209,8 @@ class TorchBasedFeatureStore(BasicFeatureStore):
else
:
else
:
raise
ValueError
(
f
"Unknown feature format
{
spec
.
format
}
"
)
raise
ValueError
(
f
"Unknown feature format
{
spec
.
format
}
"
)
super
().
__init__
(
features
)
super
().
__init__
(
features
)
def
pin_memory_
(
self
):
"""In-place operation to copy the feature store to pinned memory."""
for
feature
in
self
.
_features
.
values
():
feature
.
pin_memory_
()
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