{"record":{"id":"df82db8ef1c1e562","repo":"tracel-ai/burn","slug":"todo-local-transfer-of-dtype-tensors-is-not","errorCode":null,"errorMessage":"todo!(\"Local transfer of {dtype:?} tensors is not supported yet\")","messagePattern":"todo!\\(\"Local transfer of (.+?) tensors is not supported yet\"\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-router/src/interpreter.rs","lineNumber":98,"sourceCode":"    }\n\n    /// Take the typed backend primitive for `tensor`, dispatching on its dtype.\n    ///\n    /// Unlike [`get_tensor_handle`](Self::get_tensor_handle) (which returns the opaque\n    /// `B::Handle`), this returns the concrete float/int/bool primitive so the caller can hand\n    /// it to `B::*_to_device`. Used by the same-host transfer path, which moves a tensor between\n    /// two interpreters living in the same server process without a host round-trip.\n    pub fn get_tensor(&mut self, tensor: &TensorIr) -> HandleKind<B> {\n        let handles = &mut self.context.handles;\n        let dtype = tensor.dtype;\n        if dtype.is_float() {\n            HandleKind::Float(handles.get_float_tensor::<B>(tensor))\n        } else if dtype.is_int() {\n            HandleKind::Int(handles.get_int_tensor::<B>(tensor))\n        } else if dtype.is_bool() {\n            HandleKind::Bool(handles.get_bool_tensor::<B>(tensor))\n        } else {\n            todo!(\"Local transfer of {dtype:?} tensors is not supported yet\");\n        }\n    }\n\n    /// Move a primitive produced on another interpreter's device onto this interpreter's device\n    /// and register it under `id`.\n    ///\n    /// The counterpart of [`get_tensor`](Self::get_tensor): the source interpreter hands over its\n    /// primitive, and the destination calls `B::*_to_device` onto its own device. When both\n    /// interpreters share the same device, the backend's `to_device` is a cheap no-op.\n    pub fn register_tensor_to_device(&mut self, id: TensorId, tensor: HandleKind<B>) {\n        let ctx = &mut self.context;\n        match tensor {\n            HandleKind::Float(tensor) => {\n                let tensor = B::float_to_device(tensor, &self.device);\n                ctx.handles.register_float_tensor::<B>(&id, tensor);\n            }\n            HandleKind::Int(tensor) => {\n                let tensor = B::int_to_device(tensor, &self.device);","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-router/src/interpreter.rs#L80-L116","documentation":"In burn-router's interpreter, `get_tensor` moves a primitive to the local device by matching dtype to Float/Int/Bool handles. Any other dtype (e.g. quantized dtypes like QInt8 or exotic numeric types) has no local transfer path, so the code hits `todo!` and panics with 'Local transfer of {dtype:?} tensors is not supported yet'.","triggerScenarios":"Executing a remote/multi-router operation where a tensor with a non-float/int/bool dtype (typically a quantized dtype) must be transferred to the local router device — e.g. fetching or using a quantized tensor result through the router without a quantization feature enabled.","commonSituations":"Running quantized inference across router-managed backends/devices; moving a quantized checkpoint tensor between GPUs/devices; a dtype added upstream but not yet wired into the router's handle transfer.","solutions":["Enable the quantization feature/paths so quantized tensors are handled by a dedicated code path instead of local transfer.","Keep quantized tensors on the device where they were produced; dequantize to float before transferring.","Use float (f32) tensors for the operation and quantize afterwards locally.","Update burn to a version where quantized local transfer is implemented."],"exampleFix":"// before\nlet q = model_quantized.output().to_device(&other_device); // panics\n// after\nlet f = model_quantized.output().dequantize();\nlet f = f.to_device(&other_device);","handlingStrategy":"validation","validationCode":"fn transferable(dtype: DType) -> bool {\n    dtype.is_float() || dtype.is_int() || dtype.is_bool()\n}\nassert!(transferable(t.dtype()), \"dequantize before device transfer\");","typeGuard":"fn is_quantized_dtype(d: DType) -> bool { !d.is_float() && !d.is_int() && !d.is_bool() }","tryCatchPattern":null,"preventionTips":["Dequantize quantized tensors before cross-device moves.","Pin quantized workloads to one device.","Check that the router/backend version supports your tensor dtypes.","Prefer float pipelines when multi-device routing is required."],"tags":["burn","quantization","device-transfer","todo"],"backgroundTag":"unsupported-dtype","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"}