tracel-ai/burn · error
int_select_assign: unsupported dtype {:?}
Error message
int_select_assign: unsupported dtype {:?} What it means
int_select_assign panics on the set-assignment path when the tensor dtype is not one of the eight implemented integer widths. select_assign writes fixed-width values at index positions, so unknown dtypes cannot be written safely and the library panics instead.
Source
Thrown at crates/burn-flex/src/ops/int.rs:341
DType::I16 => crate::ops::gather_scatter::select_assign::<i16>(
tensor, dim, indices, value,
),
DType::I8 => {
crate::ops::gather_scatter::select_assign::<i8>(tensor, dim, indices, value)
}
DType::U64 => crate::ops::gather_scatter::select_assign::<u64>(
tensor, dim, indices, value,
),
DType::U32 => crate::ops::gather_scatter::select_assign::<u32>(
tensor, dim, indices, value,
),
DType::U16 => crate::ops::gather_scatter::select_assign::<u16>(
tensor, dim, indices, value,
),
DType::U8 => {
crate::ops::gather_scatter::select_assign::<u8>(tensor, dim, indices, value)
}
dt => panic!("int_select_assign: unsupported dtype {:?}", dt),
}
}
burn_backend::tensor::IndexingUpdateOp::Add => {
debug_assert_eq!(
tensor.dtype(),
value.dtype(),
"int_select_assign: dtype mismatch"
);
match tensor.dtype() {
DType::I64 => {
crate::ops::gather_scatter::select_add::<i64>(tensor, dim, indices, value)
}
DType::I32 => {
crate::ops::gather_scatter::select_add::<i32>(tensor, dim, indices, value)
}
DType::I16 => {
crate::ops::gather_scatter::select_add::<i16>(tensor, dim, indices, value)
}View on GitHub (pinned to d16f7ba2ed)
Solutions
- Cast tensor and value to a supported int dtype before the select_assign call
- Guarantee tensor.dtype() == value.dtype() as a precondition
- Confirm Set is the intended update op; this panic is the Set arm
- Add a select_assign match arm calling crate::ops::gather_scatter::select_assign::<T> for new dtypes
Example fix
// before tensor.select_assign(dim, indices, value, IndexingUpdateOp::Set); // tensor is DType::Bool // after let tensor = tensor.cast(DType::I32); let value = value.cast(DType::I32); tensor.select_assign(dim, indices, value, IndexingUpdateOp::Set);
Defensive patterns
Strategy: validation
Validate before calling
assert_eq!(tensor.dtype(), value.dtype(), "select_assign: dtype mismatch");
assert!(is_supported_int_dtype(tensor.dtype()), "unsupported dtype {:?}", tensor.dtype()); Type guard
fn is_supported_int_dtype(dt: burn::tensor::DType) -> bool {
matches!(
dt,
burn::tensor::DType::I64 | burn::tensor::DType::I32
| burn::tensor::DType::I16 | burn::tensor::DType::I8
| burn::tensor::DType::U64 | burn::tensor::DType::U32
| burn::tensor::DType::U16 | burn::tensor::DType::U8
)
} Prevention
- Normalize tensor and value to the same int dtype before select_assign
- Use Set updates only on integer tensors
- Enable debug_asserts in CI to catch dtype mismatches early
- Keep dtype casts explicit at API boundaries
When it happens
Trigger: Calling int_select_assign with IndexingUpdateOp::Set on a tensor whose dtype is not i64/i32/i16/i8/u64/u32/u16/u8, or when tensor and value dtypes differ so the wrong arm is evaluated.
Common situations: Assigning into selected ranges of bool-masked tensors, dtype drift between target and value, or a burn upgrade introducing a DType variant burn-flex does not cover.
Related errors
- float_select_assign: unsupported dtype {:?}
- int_gather: unsupported dtype {:?}
- int_scatter: unsupported dtype {:?}
- int_scatter_nd: unsupported dtype {:?}
- int_gather_nd: unsupported dtype {:?}
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/e5490af705d25389.
Report an issue: GitHub.