You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import torch
import torch.nn as nn
import time
import spconv.pytorch as spconv
x = torch.zeros(64, 16, 124, 124, dtype=torch.float16).cuda()
for i in range(10):
x[0 , 0, i, 0]=1
x1 =x.to(dtype=torch.float32)
cv1 = nn.Conv2d(16, 16, 3, 1, 1,).half().cuda()
cv2 = nn.Conv2d(16, 16, 3, 1, 1,).cuda()
cv3 = spconv.SubMConv2d(16, 16, 3, 1, padding=1, indice_key="asd", algo=spconv.ConvAlgo.Native).half().cuda()
cv4 = spconv.SubMConv2d(16, 16, 3, 1, padding=1, indice_key="asd", algo=spconv.ConvAlgo.Native).cuda()
s= x.permute(0,2,3,1)
s = spconv.SparseConvTensor.from_dense(s)
s1= x1.permute(0,2,3,1)
s1 = spconv.SparseConvTensor.from_dense(s1)
for i in range(10):
a = time.time()
y1 = cv3(s)
b = time.time()
print(b-a)
for i in range(10):
a = time.time()
y1 = cv4(s1)
b = time.time()
print(b-a)
My test code is as follows:
However, when I tested with the cpu, the test result show that the GPU does not achieve acceleration:
Did I make a mistake calling the test? I sincerely hope to get an answer. Thank you for your help.
Supplementary description:
The text was updated successfully, but these errors were encountered: