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
SparseConvNet
Commits
297e04c0
Unverified
Commit
297e04c0
authored
Mar 02, 2018
by
Ben Graham
Committed by
GitHub
Mar 02, 2018
Browse files
Merge pull request #33 from facebookresearch/cuda_async
Expose option to perform async CUDA copies
parents
cd5f3fc1
646c11b0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
PyTorch/sparseconvnet/sparseConvNetTensor.py
PyTorch/sparseconvnet/sparseConvNetTensor.py
+5
-4
No files found.
PyTorch/sparseconvnet/sparseConvNetTensor.py
View file @
297e04c0
...
...
@@ -9,6 +9,7 @@ import torch
from
.utils
import
dim_fn
from
torch.autograd
import
Variable
class
SparseConvNetTensor
(
object
):
def
__init__
(
self
,
features
=
None
,
metadata
=
None
,
spatial_size
=
None
):
self
.
features
=
features
...
...
@@ -30,8 +31,8 @@ class SparseConvNetTensor(object):
return
self
return
self
.
features
.
type
()
def
cuda
(
self
):
self
.
features
=
self
.
features
.
cuda
()
def
cuda
(
self
,
async
=
False
):
self
.
features
=
self
.
features
.
cuda
(
async
=
async
)
return
self
def
cpu
(
self
):
...
...
@@ -47,7 +48,7 @@ class SparseConvNetTensor(object):
return
'SparseConvNetTensor<<'
+
\
repr
(
self
.
features
)
+
repr
(
self
.
metadata
)
+
repr
(
self
.
spatial_size
)
+
'>>'
def
to_variable
(
self
,
requires_grad
=
False
,
volatile
=
False
):
def
to_variable
(
self
,
requires_grad
=
False
,
volatile
=
False
):
"Convert self.features to a variable for use with modern PyTorch interface."
self
.
features
=
Variable
(
self
.
features
,
requires_grad
=
requires_grad
,
volatile
=
volatile
)
self
.
features
=
Variable
(
self
.
features
,
requires_grad
=
requires_grad
,
volatile
=
volatile
)
return
self
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