From 3146837bfd7ceed15e300318814d6817eb9c1792 Mon Sep 17 00:00:00 2001 From: Sebastian Larsson Date: Mon, 29 Jun 2026 14:34:49 +0200 Subject: [PATCH] Arm backend: Avoid tensor copy warning in quant config 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. Change-Id: I8a19737785a481f30f6eacc9340ebfa07eab962c Signed-off-by: Sebastian Larsson --- backends/arm/quantizer/quantization_config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backends/arm/quantizer/quantization_config.py b/backends/arm/quantizer/quantization_config.py index a076d20743e..8c2ec2c8609 100644 --- a/backends/arm/quantizer/quantization_config.py +++ b/backends/arm/quantizer/quantization_config.py @@ -189,9 +189,9 @@ def _derive_qparams_fn( weight_obs_or_fq = obs_or_fqs[1] act_scale, _ = act_obs_or_fq.calculate_qparams() weight_scale, _ = weight_obs_or_fq.calculate_qparams() - return torch.tensor(act_scale * weight_scale).to( - torch.float32 - ), torch.full_like(weight_scale, fill_value=0, dtype=torch.int32) + return (act_scale * weight_scale).to(torch.float32), torch.full_like( + weight_scale, fill_value=0, dtype=torch.int32 + ) if node.target in [ torch.ops.aten.conv1d.default,