Update examples to new API (#205)

This commit is contained in:
Liam
2020-12-19 18:04:12 +01:00
committed by GitHub
parent 3c9150a9f4
commit 075cf4bc02
3 changed files with 5 additions and 5 deletions

View File

@@ -38,7 +38,7 @@ def infer(model, img):
# run the net
if GPU:
out = model.forward(Tensor(img).cuda()).cpu()
out = model.forward(Tensor(img).gpu()).cpu()
else:
out = model.forward(Tensor(img))
@@ -55,7 +55,7 @@ if __name__ == "__main__":
model = EfficientNet(int(os.getenv("NUM", "0")))
model.load_weights_from_torch()
if GPU:
[x.cuda_() for x in get_parameters(model)]
[x.gpu_() for x in get_parameters(model)]
# category labels
import ast