We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the code
sumprod = torch.zeros((h_im - h_conv + 1, w_im - w_conv + 1)) for i in range(h_im - h_conv + 1): for j in range(w_im - w_conv + 1): img_subset = X_train[0, 0, i:(i+3), j:(j+3)] model_filter = cnn_w.reshape(3,3) val = torch.sum(img_subset*model_filter) + cnn_b sumprod[i,j] = val
Sumprod is on the CPU device, while X_train and model_filter that come from the cnn_w form the model are both init on the GPU
CPU
X_train
model_filter
cnn_w
GPU
So when come the assignment, there will have an issues, and the sumprod will look like this
tensor([[val, 0], [0, 0]])
To fix it, just specify the device to sumprod
sumprod = torch.zeros((h_im - h_conv + 1, w_im - w_conv + 1)).to(device)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In the code
Sumprod is on the
CPU
device, whileX_train
andmodel_filter
that come from thecnn_w
form the model are both init on theGPU
So when come the assignment, there will have an issues, and the sumprod will look like this
To fix it, just specify the device to sumprod
The text was updated successfully, but these errors were encountered: