tracel-ai/burn · error

int_select_assign with {other:?} update is not implemented

Error message

int_select_assign with {other:?} update is not implemented

What it means

burn-flex's `int_select_assign` only accepts integer-family update dtypes; a float (or other non-int) `values` tensor falls into the `other` arm and panics with `unimplemented!("int_select_assign with {other:?} update is not implemented")`.

Source

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

                        crate::ops::gather_scatter::select_mul::<i8>(tensor, dim, indices, value)
                    }
                    DType::U64 => {
                        crate::ops::gather_scatter::select_mul::<u64>(tensor, dim, indices, value)
                    }
                    DType::U32 => {
                        crate::ops::gather_scatter::select_mul::<u32>(tensor, dim, indices, value)
                    }
                    DType::U16 => {
                        crate::ops::gather_scatter::select_mul::<u16>(tensor, dim, indices, value)
                    }
                    DType::U8 => {
                        crate::ops::gather_scatter::select_mul::<u8>(tensor, dim, indices, value)
                    }
                    dt => panic!("int_select_assign: unsupported dtype {:?}", dt),
                }
            }
            other => {
                unimplemented!("int_select_assign with {other:?} update is not implemented")
            }
        }
    }

    fn int_equal(
        lhs: IntTensor<Flex>,
        rhs: IntTensor<Flex>,
        out_dtype: burn_std::BoolDType,
    ) -> BoolTensor<Flex> {
        crate::ops::comparison::int_equal(lhs, rhs, out_dtype)
    }

    fn int_equal_elem(
        lhs: IntTensor<Flex>,
        rhs: Scalar,
        out_dtype: burn_std::BoolDType,
    ) -> BoolTensor<Flex> {
        let (i, u) = scalar_to_int_pair(lhs.dtype(), &rhs);

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Cast the value tensor to the int dtype before assigning: `values.cast(DType::I64)` / `.int()`
  2. Use a float data tensor if float assignments are intended
  3. Assert value.dtype.is_int() before the call
  4. Trace where the float value tensor originates and fix it upstream

Example fix

// before
let out = labels.select_assign(dim, indices, scores_f32);
// after
let out = labels.select_assign(dim, indices, scores_f32.cast(DType::I64));
Defensive patterns

Strategy: type-guard

Validate before calling

assert!(values.dtype().is_int() || values.dtype().is_uint(), "int_select_assign requires an int/uint update tensor");

Type guard

fn is_int_dtype(d: DType) -> bool {
    d.is_int() || d.is_uint()
}

Try / catch

// guard before the call; the panic is not recoverable
if !is_int_dtype(values.dtype()) {
    values = values.cast(labels.dtype());
}
let out = labels.select_assign(dim, indices, values);

Prevention

When it happens

Trigger: Calling `int_select_assign` / select_assign on an int tensor while passing a float `values` tensor.

Common situations: Assigning float scores/weights into index tensors; tensors defaulting to F32 elsewhere in the pipeline then reused for int assignments.

Related errors


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