Make introduction example run on devices (#18097)

This commit is contained in:
Adrian Wälchli 2023-07-17 17:19:16 +02:00 committed by GitHub
parent ea92c218cc
commit b8d4a70db7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -204,7 +204,7 @@ Once you've trained the model you can export to onnx, torchscript and put it int
encoder.eval() encoder.eval()
# embed 4 fake images! # embed 4 fake images!
fake_image_batch = Tensor(4, 28 * 28) fake_image_batch = torch.rand(4, 28 * 28, device=autoencoder.device)
embeddings = encoder(fake_image_batch) embeddings = encoder(fake_image_batch)
print("⚡" * 20, "\nPredictions (4 image embeddings):\n", embeddings, "\n", "⚡" * 20) print("⚡" * 20, "\nPredictions (4 image embeddings):\n", embeddings, "\n", "⚡" * 20)