tracel-ai/burn · error

int_cummin: unsupported dtype {:?}

Error message

int_cummin: unsupported dtype {:?}

What it means

int_cummin computes the running minimum along a dimension for each supported integer dtype (I64..U8). The panic fires when the tensor dtype is a non-integer type (float/bool), meaning the wrong tensor kind reached the integer cumulative-min path. Purely a dtype-dispatch guard.

Source

Thrown at crates/burn-flex/src/ops/int.rs:724

            DType::U64 => crate::ops::cumulative::cumprod::<u64>(tensor, dim),
            DType::U32 => crate::ops::cumulative::cumprod::<u32>(tensor, dim),
            DType::U16 => crate::ops::cumulative::cumprod::<u16>(tensor, dim),
            DType::U8 => crate::ops::cumulative::cumprod::<u8>(tensor, dim),
            dt => panic!("int_cumprod: unsupported dtype {:?}", dt),
        }
    }

    fn int_cummin(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex> {
        match tensor.dtype() {
            DType::I64 => crate::ops::cumulative::cummin::<i64>(tensor, dim),
            DType::I32 => crate::ops::cumulative::cummin::<i32>(tensor, dim),
            DType::I16 => crate::ops::cumulative::cummin::<i16>(tensor, dim),
            DType::I8 => crate::ops::cumulative::cummin::<i8>(tensor, dim),
            DType::U64 => crate::ops::cumulative::cummin::<u64>(tensor, dim),
            DType::U32 => crate::ops::cumulative::cummin::<u32>(tensor, dim),
            DType::U16 => crate::ops::cumulative::cummin::<u16>(tensor, dim),
            DType::U8 => crate::ops::cumulative::cummin::<u8>(tensor, dim),
            dt => panic!("int_cummin: unsupported dtype {:?}", dt),
        }
    }

    fn int_cummax(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex> {
        match tensor.dtype() {
            DType::I64 => crate::ops::cumulative::cummax::<i64>(tensor, dim),
            DType::I32 => crate::ops::cumulative::cummax::<i32>(tensor, dim),
            DType::I16 => crate::ops::cumulative::cummax::<i16>(tensor, dim),
            DType::I8 => crate::ops::cumulative::cummax::<i8>(tensor, dim),
            DType::U64 => crate::ops::cumulative::cummax::<u64>(tensor, dim),
            DType::U32 => crate::ops::cumulative::cummax::<u32>(tensor, dim),
            DType::U16 => crate::ops::cumulative::cummax::<u16>(tensor, dim),
            DType::U8 => crate::ops::cumulative::cummax::<u8>(tensor, dim),
            dt => panic!("int_cummax: unsupported dtype {:?}", dt),
        }
    }

    fn int_argmax(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex> {

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Assert/verify the tensor dtype is integer before calling cummin; cast to i64/i32 if necessary.
  2. Use a float-specific min/cumulative implementation for float tensors.
  3. Fix upstream dtype-promoting operations with explicit casts.
  4. Log dtypes at module boundaries when porting multi-dtype pipelines.

Example fix

// before
let out = t.cummin(dim); // t is BF16 -> panic
// after
let out_i = t.cast::<i32>();
let out = out_i.cummin(dim);
Defensive patterns

Strategy: validation

Validate before calling

assert!(t.dtype().is_int(), "cummin requires an int tensor, got {:?}", t.dtype());

Type guard

fn is_int_tensor(t: &FlexTensor) -> bool { matches!(t.dtype(), DType::I64 | DType::I32 | DType::I16 | DType::I8 | DType::U64 | DType::U32 | DType::U16 | DType::U8) }

Prevention

When it happens

Trigger: Calling cummin (int_cummin) on a Flex tensor whose dtype is F32/F64/F16/BF16 or Bool.

Common situations: Porting code from frameworks where cummin is dtype-agnostic; a prior cast/division produced floats; model checkpoint tensors loaded with float dtype where ints were expected.

Related errors


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