tracel-ai/burn · error

Unsupported reparameterization tensor rank: {other}

Error message

Unsupported reparameterization tensor rank: {other}

What it means

Rank-dispatch exhaustiveness guard in the reparameterization macro: tensor ranks 1 through 8 are expanded into specialized code paths, and any tensor outside that range (rank 0, or 9+) hits the `other` arm. The failing input is a DynModule parameter tensor whose rank the reparameterization machinery cannot specialize.

Source

Thrown at crates/burn-core/src/module/param/reparameterization_dyn.rs:178

                $body
            }
            5 => {
                const $d: usize = 5;
                $body
            }
            6 => {
                const $d: usize = 6;
                $body
            }
            7 => {
                const $d: usize = 7;
                $body
            }
            8 => {
                const $d: usize = 8;
                $body
            }
            other => panic!("Unsupported reparameterization tensor rank: {other}"),
        }
    };
}

/// Borrowed type-erased parameter passed through [`DynModuleVisitor`].
///
/// The runtime rank identifies the concrete `Param<Tensor<D, K>>` stored in `value`.
pub struct DynParamRef<'a> {
    rank: usize,
    value: &'a dyn Any,
}

impl<'a> DynParamRef<'a> {
    fn new<T: Any>(rank: usize, value: &'a T) -> Self {
        Self { rank, value }
    }
}

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Use a tensor of rank 1–8; reshape or squeeze unit dimensions to bring the rank into the supported range.
  2. If higher ranks are genuinely needed, extend the macro to generate more rank arms and recompile.
  3. Check that the module field type declares the intended const rank D rather than an accidental scalar/extra-dim tensor.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/burn-core/src/module/param/reparameterization_dyn.rs:178 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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