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
8c71f3f8
"tests/python/pytorch/sparse/test_sparse_matrix.py" did not exist on "ff090f698e0fbb2382f7c8ec2ca20a2e4500efdd"
Commit
8c71f3f8
authored
Aug 29, 2018
by
Minjie Wang
Browse files
Fix treelstm CPU
parent
b7eb1659
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
examples/pytorch/tree_lstm/train.py
examples/pytorch/tree_lstm/train.py
+8
-5
No files found.
examples/pytorch/tree_lstm/train.py
View file @
8c71f3f8
...
...
@@ -67,13 +67,16 @@ def main(args):
for
epoch
in
range
(
args
.
epochs
):
t_epoch
=
time
.
time
()
for
step
,
batch
in
enumerate
(
train_loader
):
if
cuda
:
batch
=
_batch_to_cuda
(
batch
)
g
=
batch
.
graph
n
=
g
.
number_of_nodes
()
x
=
th
.
zeros
((
n
,
args
.
x_size
)).
cuda
()
h
=
th
.
zeros
((
n
,
args
.
h_size
)).
cuda
()
c
=
th
.
zeros
((
n
,
args
.
h_size
)).
cuda
()
x
=
th
.
zeros
((
n
,
args
.
x_size
))
h
=
th
.
zeros
((
n
,
args
.
h_size
))
c
=
th
.
zeros
((
n
,
args
.
h_size
))
if
cuda
:
batch
=
_batch_to_cuda
(
batch
)
x
=
x
.
cuda
()
h
=
h
.
cuda
()
c
=
c
.
cuda
()
if
step
>=
3
:
t0
=
time
.
time
()
...
...
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