Unverified Commit 6de7d5fa authored by Hao Yuan's avatar Hao Yuan Committed by GitHub
Browse files

[Bugfix] Fix conditional judgment of cuda (#4026) (#4027)

parent 4b87e47f
......@@ -107,6 +107,7 @@ def main(args):
for epoch in range(args.epochs):
model.train()
if epoch >= 3:
if cuda:
torch.cuda.synchronize()
t0 = time.time()
# forward
......@@ -118,6 +119,7 @@ def main(args):
optimizer.step()
if epoch >= 3:
if cuda:
torch.cuda.synchronize()
dur.append(time.time() - t0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment