Created
October 14, 2020 05:47
-
-
Save shwang/53f8a522dfe052f177749dbf62abc4f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch as th | |
import torch.utils.data as th_data | |
def main(): | |
x = th.ones([30, 3, 3], requires_grad=True) | |
y = x * 2 | |
dl = th_data.DataLoader(y) | |
batch = next(iter(dl)) | |
print(f"batch: {batch}") | |
batch2 = th.as_tensor(batch) | |
print(f"batch2: {batch2}") | |
print(f"batch is batch2: {batch is batch2}") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment