tracel-ai/burn · error

Distributed operations are not supported for tensor kind {ot

Error message

Distributed operations are not supported for tensor kind {other:?}

What it means

set_distributed_params only supports distributed-capable backends (Cube via cube_backend, Remote via the remote feature). Any other inner tensor kind (Flex, NdArray, LibTorch, Capture, Int/Bool variants, etc.) reaches the catch-all arm and panics with the unsupported kind name, because only collective-capable backends can carry distributed parameter metadata.

Source

Thrown at crates/burn-dispatch/src/backend.rs:656

                            param_id,
                        )),
                    )))
                }
                #[cfg(feature = "remote")]
                DispatchTensorKind::Remote(tensor) => {
                    DispatchTensorKind::Autodiff(Box::new(DispatchTensorKind::Remote(
                        crate::BackendTensor::Autodiff(Autodiff::<Remote>::set_distributed_params(
                            tensor.as_autodiff().clone(),
                            param_id,
                        )),
                    )))
                }
                DispatchTensorKind::Autodiff(_) => {
                    panic!("Autodiff should not wrap an autodiff tensor.")
                }
                #[allow(unreachable_patterns)]
                other => {
                    panic!("Distributed operations are not supported for tensor kind {other:?}")
                }
            },
            _ => panic!("Requires autodiff tensor."),
        };

        DispatchTensor { kind, autodiff }
    }

    #[allow(unused_variables)]
    fn distributed_params(tensor: &DispatchTensor) -> Option<DistributedParams> {
        let DispatchTensor { kind, autodiff: _ } = tensor;

        match &kind {
            DispatchTensorKind::Autodiff(inner_kind) => match &**inner_kind {
                #[cfg(cube_backend)]
                DispatchTensorKind::Cube(tensor) => {
                    tensor.as_autodiff().node.distributed_params.clone()
                }

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Run the distributed workload on Cube or Remote backend (enable the `remote` feature or a cube_backend) so the tensor kind matches the distributed arms.
  2. Only call set_distributed_params (distributed parameter registration) on tensors from a collective-capable backend; skip it on other backends.
  3. Check tensor.kind before the call and branch to a non-distributed path when the kind is not Autodiff(Cube|Remote).

Example fix

// before: registering distributed params regardless of backend
let t = set_distributed_params(tensor, param_id); // panics on NdArray/Flex

// after: guard on backend kind
if matches!(
    &tensor.kind,
    DispatchTensorKind::Autodiff(inner)
        if matches!(**inner, DispatchTensorKind::Cube(_) | DispatchTensorKind::Remote(_))
) {
    let t = set_distributed_params(tensor, param_id);
} else {
    // non-distributed path
}
Defensive patterns

Strategy: validation

Validate before calling

fn supports_distributed(t: &DispatchTensor) -> bool {
    matches!(
        &t.kind,
        DispatchTensorKind::Autodiff(inner)
            if matches!(**inner, DispatchTensorKind::Cube(_) | DispatchTensorKind::Remote(_))
    )
}
if supports_distributed(&tensor) {
    let t = set_distributed_params(tensor, param_id);
} else {
    // fall back to non-distributed handling
}

Type guard

fn is_distributed_capable(t: &DispatchTensor) -> bool {
    matches!(
        &t.kind,
        DispatchTensorKind::Autodiff(inner)
            if matches!(**inner, DispatchTensorKind::Cube(_) | DispatchTensorKind::Remote(_))
    )
}

Try / catch

// panic-based; check is_distributed_capable before registering DistributedParamId

Prevention

When it happens

Trigger: Calling set_distributed_params on a tensor whose inner kind is not Cube or Remote — e.g. NdArray/Flex/LibTorch tensors, or a build where cube_backend/remote cfgs exclude the arms. The panic message embeds the offending kind via Debug formatting.

Common situations: Distributed training code registering DistributedParamId on a model running on a non-distributed backend (e.g. local NdArray or LibTorch); forgetting to enable the `remote` feature (or cube backend) so the tensor stays on a non-collective backend; running distributed workflows on a single-node backend.

Related errors


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