I improve my code:
start = time.process_time()
a = torch.randn(8, 8000, 1, 1728)
b = torch.randn(8000, 1728, 3)
#a = a.half()
#b = b.half()
if True:
device = torch.device(“cuda”)
else:
device = torch.device(“cpu”)
a = a.to(device)
b = b.to(device)
torch.matmul(a, b)
end = time.process_time()
print(“Elapsed time of {}: {} s”.format(‘main’, np.round(end - start, decimals=5)))
FP16: 4.7057 s
FP32: 3.43783 s