Skip to content

Commit 5bce981

Browse files
Arm backend: Avoid tensor copy warning in quant config (#20687)
The scale product is already a tensor, so wrapping it with torch.tensor emits a PyTorch copy-construction warning. Use it directly and cast it to float32 instead. Signed-off-by: Sebastian Larsson <sebastian.larsson@arm.com>
1 parent 3bd4748 commit 5bce981

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

backends/arm/quantizer/quantization_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ def _derive_qparams_fn(
189189
weight_obs_or_fq = obs_or_fqs[1]
190190
act_scale, _ = act_obs_or_fq.calculate_qparams()
191191
weight_scale, _ = weight_obs_or_fq.calculate_qparams()
192-
return torch.tensor(act_scale * weight_scale).to(
193-
torch.float32
194-
), torch.full_like(weight_scale, fill_value=0, dtype=torch.int32)
192+
return (act_scale * weight_scale).to(torch.float32), torch.full_like(
193+
weight_scale, fill_value=0, dtype=torch.int32
194+
)
195195

196196
if node.target in [
197197
torch.ops.aten.conv1d.default,

0 commit comments

Comments
 (0)