{"record":{"id":"5c5da46720dbbf10","repo":"tracel-ai/burn","slug":"can-t-differentiate-deform-conv-2d-backward","errorCode":null,"errorMessage":"Can't differentiate deform conv 2d backward.","messagePattern":"Can't differentiate deform conv 2d backward\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-autodiff/src/ops/module.rs","lineNumber":915,"sourceCode":"                    weight.primitive,\n                    None,\n                    None,\n                    options,\n                )),\n            },\n        }\n    }\n\n    fn deform_conv2d_backward(\n        _x: AutodiffTensor<B>,\n        _offset: AutodiffTensor<B>,\n        _weight: AutodiffTensor<B>,\n        _mask: Option<AutodiffTensor<B>>,\n        _bias: Option<AutodiffTensor<B>>,\n        _output_grad: AutodiffTensor<B>,\n        _options: DeformConvOptions<2>,\n    ) -> DeformConv2dBackward<Self> {\n        panic!(\"Can't differentiate deform conv 2d backward.\");\n    }\n\n    fn conv_transpose2d(\n        x: AutodiffTensor<B>,\n        weight: AutodiffTensor<B>,\n        bias: Option<AutodiffTensor<B>>,\n        options: ConvTransposeOptions<2>,\n    ) -> AutodiffTensor<B> {\n        #[derive(Debug)]\n        struct ConvTranspose2DWithBias;\n        #[derive(Debug)]\n        struct ConvTranspose2DNoBias;\n\n        impl<B: Backend> Backward<B, 3> for ConvTranspose2DWithBias {\n            type State = (NodeId, NodeId, NodeId, ConvTransposeOptions<2>);\n\n            fn backward(\n                self,","sourceCodeStart":897,"sourceCodeEnd":933,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-autodiff/src/ops/module.rs#L897-L933","documentation":"q_to_device (moving a quantized tensor to another device) is stubbed in BackendRouter's QTensorOps and panics. Related stubs (q_reshape, etc.) show the whole router quantized-tensor surface is unimplemented.","triggerScenarios":"Calling q_to_device / Tensor::to_device on a quantized tensor whose backend is BackendRouter; multi-GPU or CPU/GPU placement changes for quantized tensors under the router.","commonSituations":"Moving quantized checkpoints to GPU for inference; device management in code generic over Backend using the router; quantized tensors crossing device boundaries.","solutions":["Move the tensor while it is still float (float to_device), then quantize on the target device's concrete backend.","Handle quantized tensors on the concrete backend that supports q_to_device.","Avoid device transfers of quantized tensors under BackendRouter until quantized ops are routed."],"exampleFix":"// before\nlet q = q_tensor.to_device(&gpu_device); // panics on BackendRouter\n// after\nlet f = ConcreteBackend::dequantize(q_tensor, FloatDType::F32);\nlet f = ConcreteBackend::float_to_device(f, &gpu_device);\nlet q = ConcreteBackend::quantize(f, &scheme, qparams);","handlingStrategy":"validation","validationCode":"fn q_device_transfer_ok(dtype: &burn_tensor::DType) -> bool {\n    !matches!(dtype, burn_tensor::DType::QFloat(_)) // move floats across devices, not quantized\n}","typeGuard":"fn is_quantized(dtype: &burn_tensor::DType) -> bool {\n    matches!(dtype, burn_tensor::DType::QFloat(_))\n}","tryCatchPattern":"std::panic::catch_unwind(std::panic::AssertUnwindSafe(||\n    q_tensor.clone().to_device(&device)\n)).map_err(|_| anyhow::anyhow!(\"q_to_device is a stub on BackendRouter; transfer before quantizing\"))","preventionTips":["Move tensors to the target device while float, then quantize there.","Avoid device transfers of QuantizedTensor under BackendRouter.","Plan device placement before quantization in multi-GPU pipelines.","Add a dtype check before every to_device call in generic code."],"tags":["rust","burn-router","quantization","device-transfer","unimplemented"],"backgroundTag":"unimplemented-api-stub","analyzedSha":"d16f7ba2ed0d41408189384044cc886fb4c8f957","analyzedAt":"2026-09-05T13:19:14.260Z","contentChangedAt":"2026-09-05T13:19:14.260Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}