-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Closed
Labels
oncall: quantizationQuantization support in PyTorchQuantization support in PyTorch
Description
❓ Questions and Help
from torch.nn.quantized import functional as qF
filters = torch.randn(1, 1, 1, 1, dtype=torch.float)
inputs = torch.randn(1, 1, 5, 5, dtype=torch.float)
bias = torch.randn(1, dtype=torch.float)
scale, zero_point = 1.0, 0
dtype = torch.qint8
q_filters = torch.quantize_per_tensor(filters, scale, zero_point, torch.qint8)
q_inputs = torch.quantize_per_tensor(inputs, scale, zero_point, torch.quint8)
qF.conv2d(q_inputs, q_filters, bias)
It works successfully on CPU, and what can I do if I want to move conv2d to GPU.
qF.conv2d(q_inputs.cuda(), q_filters.cuda(), bias.cuda())
I tried in this way and got mistakes as below.
RuntimeError: Didn't find kernel to dispatch to for operator 'quantized::conv_prepack'. Tried to look up kernel for dispatch key 'CUDATensorId'. Registered dispatch keys are:[QuantizedCPUTensorId] (lookup_ at /opt/conda/conda-bld/pytorch_1570711556059/work/aten/src/ATen/core/dispatch/DispatchTable.h:249)
Metadata
Metadata
Assignees
Labels
oncall: quantizationQuantization support in PyTorchQuantization support in PyTorch