tracel-ai/burn · error

float_select_assign with {other:?} update is not implemented

Error message

float_select_assign with {other:?} update is not implemented

What it means

float_select_assign on the CubeCl backend supports only IndexingUpdateOp::Add and IndexingUpdateOp::Mul; any other variant reaches the catch-all and panics with unimplemented!. It mirrors the int_select_assign limitation at crates/burn-cubecl/src/ops/tensor.rs:237.

Source

Thrown at crates/burn-cubecl/src/ops/tensor.rs:237

    fn float_select_assign(
        tensor: FloatTensor<Self>,
        dim: usize,
        indices: IntTensor<Self>,
        value: FloatTensor<Self>,
        update: burn_backend::tensor::IndexingUpdateOp,
    ) -> FloatTensor<Self> {
        match update {
            burn_backend::tensor::IndexingUpdateOp::Assign => {
                kernel::select_assign_replace(tensor, dim, indices, value)
            }
            burn_backend::tensor::IndexingUpdateOp::Add => {
                kernel::select_assign(tensor, dim, indices, value, false)
            }
            burn_backend::tensor::IndexingUpdateOp::Mul => {
                kernel::select_assign_mul(tensor, dim, indices, value)
            }
            other => {
                unimplemented!("float_select_assign with {other:?} update is not implemented")
            }
        }
    }

    fn float_slice(tensor: FloatTensor<Self>, slices: &[Slice]) -> FloatTensor<Self> {
        // Check if all steps are 1
        let all_steps_one = slices.iter().all(|info| info.step == 1);

        if all_steps_one {
            // Use optimized slice for step=1
            let simple_ranges: Vec<Range<usize>> = slices
                .iter()
                .enumerate()
                .map(|(i, slice)| slice.to_range(tensor.meta.shape()[i]))
                .collect();

            kernel::slice(tensor, &simple_ranges)
        } else {

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Use Add or Mul; for Sub, assign the negated values with Add.
  2. Restructure as gather -> compute -> scatter/slice_assign for arbitrary updates.
  3. Patch the backend: add a float select_assign kernel for the missing variant in crates/burn-cubecl/src/ops/tensor.rs.
  4. Wrap exotic update ops behind a helper that checks backend support first.

Example fix

// before
let out = tensor.select_assign(dim, indices, updates, IndexingUpdateOp::Sub);
// after
let out = tensor.select_assign(dim, indices, -updates, IndexingUpdateOp::Add);
Defensive patterns

Strategy: validation

Validate before calling

if !matches!(op, IndexingUpdateOp::Add | IndexingUpdateOp::Mul) {
    eprintln!("float_select_assign on CubeCl supports only Add/Mul; falling back");
}

Type guard

fn select_assign_supported(op: &IndexingUpdateOp) -> bool {
    matches!(op, IndexingUpdateOp::Add | IndexingUpdateOp::Mul)
}

Prevention

When it happens

Trigger: Calling float_select_assign (or Tensor::select_assign) with the CubeCl backend and an IndexingUpdateOp other than Add/Mul (e.g. Sub).

Common situations: Masked/conditional updates with subtraction semantics; shared code across backends where another backend supports the op; upgrades introducing new IndexingUpdateOp variants.

Related errors


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