{"record":{"id":"e5cbc383ddde27cd","repo":"huggingface/candle","slug":"metal-col2im1d-dtype-not-implemented","errorCode":null,"errorMessage":"metal col2im1d {dtype:?} not implemented","messagePattern":"metal col2im1d (.+?) not implemented","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"candle-core/src/metal_backend/mod.rs","lineNumber":1025,"sourceCode":"                    \"convtr1d: shape mismatch on c_in {:?} {:?}\",\n                    layout.shape(),\n                    k_layout.shape()\n                )\n            }\n            let buffer = self\n                .device\n                .new_buffer_builder()\n                .with_size_for(dst_el, self.dtype)\n                .with_label(\"conv_transpose1d\")\n                .build()?;\n\n            let name = match self.dtype {\n                DType::F32 => \"col2im1d_f32\",\n                DType::F16 => \"col2im1d_f16\",\n                DType::BF16 => \"col2im1d_bf16\",\n                DType::U32 => \"col2im1d_u32\",\n                DType::U8 => \"col2im1d_u8\",\n                dtype => crate::bail!(\"metal col2im1d {dtype:?} not implemented\"),\n            };\n            let col = {\n                // This merges the last two dimensions of the kernel together.\n                let kernel_l_mm = Layout::new(\n                    (b_size, c_in, k_size * c_out).into(),\n                    vec![0, k_size * c_out, 1],\n                    k_layout.start_offset(),\n                );\n                self.matmul(\n                    k,\n                    (b_size, l_in, c_out * k_size, c_in),\n                    &layout.transpose(1, 2)?,\n                    &kernel_l_mm,\n                )?\n            };\n            // It is important for the command encoder to be obtained *after* the matmul\n            // kernel has run, otherwise we might use a command-buffer that has been committed\n            // already resulting in the following error.","sourceCodeStart":1007,"sourceCodeEnd":1043,"githubUrl":"https://github.com/huggingface/candle/blob/d5fee525bfde3273eb7c9b75fd2bc4937be867ca/candle-core/src/metal_backend/mod.rs#L1007-L1043","documentation":"In the col2im-based conv_transpose1d path, Metal dispatches a col2im1d kernel by dtype; only F32, F16, BF16, U32, U8 have kernels. Any other dtype bails here, meaning transposed convolution cannot run for that dtype via this path.","triggerScenarios":"Calling conv_transpose1d on Metal (with USE_COL2IM_CONV1D_TR enabled and col2im applicable) on an I64 or otherwise unsupported dtype tensor.","commonSituations":"Integer activations flowing into a transposed conv; dtype mismatch from a quantization pipeline; models ported with weights in i64.","solutions":["Cast input and kernel to F32/F16/BF16 before conv_transpose1d","Cast back to the original dtype after the op if needed","Run conv_transpose1d on CPU for that tensor"],"exampleFix":"// before\nlet y = x_i64.conv_transpose1d(&k, padding, output_padding, stride, dilation, groups)?;\n// after\nlet y = x_i64.to_dtype(DType::F32)?.conv_transpose1d(&k.to_dtype(DType::F32)?, padding, output_padding, stride, dilation, groups)?;","handlingStrategy":"fallback","validationCode":"if !matches!(x.dtype(), DType::F32 | DType::F16 | DType::BF16 | DType::U32 | DType::U8) {\n    x = x.to_dtype(DType::F32)?;\n    kernel = kernel.to_dtype(DType::F32)?;\n}","typeGuard":null,"tryCatchPattern":"match x.conv_transpose1d(&k, p, op, s, d, g) {\n    Ok(y) => y,\n    Err(e) if e.to_string().contains(\"col2im1d\") => {\n        x.to_dtype(DType::F32)?.conv_transpose1d(&k.to_dtype(DType::F32)?, p, op, s, d, g)\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Cast to float before transposed convolutions on Metal","Keep quantized tensors dequantized before conv layers","Test the conv stack on Metal with your exact dtypes"],"tags":["metal","gpu","conv-transpose","col2im","dtype","candle"],"backgroundTag":"unsupported-dtype-for-op","analyzedSha":"d5fee525bfde3273eb7c9b75fd2bc4937be867ca","analyzedAt":"2026-09-02T00:15:47.023Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}