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` maps an IndexingUpdateOp onto select_assign kernels; only Set/Add/Mul (via TchOps::select_assign and select_assign_mul) are implemented. Any other update op panics with this unimplemented!() message.

Source

Thrown at crates/burn-tch/src/ops/tensor.rs:253

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

    fn float_slice(tensor: TchTensor, slices: &[burn_backend::Slice]) -> TchTensor {
        TchOps::slice_with_steps(tensor, slices)
    }

    fn float_slice_assign(
        tensor: TchTensor,
        slices: &[burn_backend::Slice],
        value: TchTensor,
    ) -> TchTensor {
        TchOps::slice_assign(tensor, slices, value)
    }

    fn float_mask_where(tensor: TchTensor, mask: TchTensor, value: TchTensor) -> TchTensor {
        let output = value.tensor.where_self(&mask.tensor, &tensor.tensor);

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Rewrite the update using a supported op: select_assign with Add of negated values for subtraction, etc.
  2. Keep burn-core and burn-tch versions in sync and upgrade if the variant is now supported
  3. Perform elementwise math after a plain Set-based select_assign
  4. Guard the call site by matching only on supported ops

Example fix

// before
tensor.select_assign(0, &idx, value, IndexingUpdateOp::Div);
// panics
// after
let inv = value.recip();
tensor.select_assign(0, &idx, inv, IndexingUpdateOp::Mul);
Defensive patterns

Strategy: validation

Validate before calling

assert!(is_supported_update(&op));

Type guard

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

Prevention

When it happens

Trigger: Calling `tensor.select_assign(dim, indices, value, op)` — or select/scatter-style assignment APIs lowering to it — with an IndexingUpdateOp other than Set/Add/Mul on a tch float tensor.

Common situations: Index-assignment code written against burn-core's expanding IndexingUpdateOp enum executed on the libtorch backend; upgrading burn-core without matching burn-tch, so new variants reach the catch-all arm.

Related errors


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