Dataset to GPU #5389
Dataset to GPU
#5389
-
Hello, I have been successfully running my models on the CPU and i would now like to run them on the GPU. I have created my own dataset using the following:
How can i put the dataset onto the gpu? Or is there a good way to do it within the model, shown below?
|
Beta Was this translation helpful? Give feedback.
Answered by
EdisonLeeeee
Sep 8, 2022
Replies: 1 comment 13 replies
-
It is convenient to transfer a for data in train_loader:
data = data.to('cuda') Or you can do it within the model def forward(self, x, edge_index, batch):
x = x.to('cuda')
edge_index = edge_index.to('cuda')
batch= batch.to('cuda') |
Beta Was this translation helpful? Give feedback.
13 replies
Answer selected by
anthonysirico
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is convenient to transfer a
data
object between CPU and GPU, e.g.,Or you can do it within the model