tracel-ai/burn · error

BURN_DEVICE=tch requested, but the 'tch' feature is not enab

Error message

BURN_DEVICE=tch requested, but the 'tch' feature is not enabled.

What it means

BURN_DEVICE selection guard for `tch`: returns the LibTorch backend only when the `tch` feature is compiled; otherwise panics. Fires when the environment requests the tch backend from a build without it.

Source

Thrown at crates/burn-dispatch/src/device.rs:266

                            feature = "metal",
                            feature = "vulkan",
                            feature = "webgpu",
                            feature = "wgpu"
                        ))]
                        return Self::Cube(CubeDevice::Wgpu(Default::default()));
                        panic!(
                            "BURN_DEVICE={device_str} requested, but no wgpu feature is enabled."
                        );
                    }
                    "cpu" => {
                        #[cfg(feature = "cpu")]
                        return Self::Cube(CubeDevice::Cpu(Default::default()));
                        panic!("BURN_DEVICE=cpu requested, but the 'cpu' feature is not enabled.");
                    }
                    "tch" => {
                        #[cfg(feature = "tch")]
                        return Self::LibTorch(LibTorchDevice::default());
                        panic!("BURN_DEVICE=tch requested, but the 'tch' feature is not enabled.");
                    }
                    "remote" => {
                        #[cfg(feature = "remote")]
                        return Self::Remote(RemoteDevice::default());
                        panic!(
                            "BURN_DEVICE=remote requested, but the 'remote' feature is not enabled."
                        );
                    }
                    "flex" => {
                        #[cfg(any(feature = "flex", default_backend))]
                        return Self::Flex(FlexDevice);
                        panic!(
                            "BURN_DEVICE=flex requested, but the 'flex' feature is not enabled."
                        );
                    }
                    "ndarray" => {
                        #[cfg(feature = "ndarray")]
                        return Self::NdArray(NdArrayDevice::default());

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Enable the `tch` feature (and provide LibTorch) and rebuild.
  2. Pick another enabled backend via BURN_DEVICE.
  3. Unset BURN_DEVICE to use the build's default backend.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/burn-dispatch/src/device.rs:266 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/c987c4c9ce113de0. Report an issue: GitHub.