tracel-ai/burn · error

Unsupported dtype {other:?}

Error message

Unsupported dtype {other:?}

What it means

Exhaustive-match guard in `NdArrayTensor::from_data_owned`: the incoming `TensorData` carries a dtype the ndarray backend's conversion macro does not handle, so the data cannot be turned into typed ndarray storage and conversion panics.

Source

Thrown at crates/burn-ndarray/src/tensor.rs:688

    ///
    /// This may or may not copy data depending on whether the underlying bytes
    /// can be reclaimed (via `try_into_vec`). If bytes are uniquely owned,
    /// no copy occurs; otherwise data is copied to a new allocation.
    fn from_data_owned(data: TensorData) -> NdArrayTensor {
        let shape = data.shape.to_vec(); // TODO: into_vec

        macro_rules! execute {
            ($data: expr, [$($dtype: pat => $ty: ty),*]) => {
                match $data.dtype {
                    $( $dtype => {
                        match data.try_into_vec::<$ty>() {
                            Ok(vec) => ArrayD::from_shape_vec(shape, vec)
                                .expect("Data should have as many elements as the shape")
                                .into_shared(),
                            Err(err) => panic!("Data should have the same element type as the tensor {err:?}"),
                        }.into()
                    }, )*
                    other => unimplemented!("Unsupported dtype {other:?}"),
                }
            };
        }

        execute!(data, [
            DType::F64 => f64, DType::F32 => f32,
            DType::I64 => i64, DType::I32 => i32, DType::I16 => i16, DType::I8 => i8,
            DType::U64 => u64, DType::U32 => u32, DType::U16 => u16, DType::U8 => u8,
            DType::Bool(BoolStore::Native) => bool
        ])
    }
}

/// A quantized tensor for the ndarray backend.
#[derive(Clone, Debug)]
pub struct NdArrayQTensor {
    /// The quantized tensor.
    pub qtensor: NdArrayTensor,

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Convert the data to a supported dtype (f32/f64, i8..i64, u8..u64, bool) before passing it to the backend
  2. Check the reported dtype and where the TensorData was produced (e.g., a checkpoint or custom kernel)
  3. Extend the `execute!` dtype list in burn-ndarray's tensor.rs if the dtype should be supported
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/burn-ndarray/src/tensor.rs:688 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05). Data as JSON: /api/errors/6a0805e5022d7bdc. Report an issue: GitHub.