[package]
authors = ["nathanielsimard <nathaniel.simard.42@gmail.com>"]
categories = ["science", "no-std", "embedded", "wasm"]
description = "Flexible and Comprehensive Deep Learning Framework in Rust"
documentation = "https://docs.rs/burn"
edition.workspace = true
keywords = [
    "deep-learning",
    "machine-learning",
    "tensor",
    "pytorch",
    "autodiff",
]
license.workspace = true
name = "burn"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn"
rust-version = "1.92"
version.workspace = true

[lints]
workspace = true

[features]
default = [
    "rl",
    "std",
    "optim",
    "burn-core/default",
    "burn-train?/default",
    "burn-nn/default",
    "burn-optim?/default",
    "burn-autodiff?/default",
]
doc = [
    "default",
    "train",
    "burn-core/doc",
    "burn-train/doc",
    "burn-store?/std",
    "burn-nn/doc",
    "burn-optim?/doc",
    "burn-autodiff?/std",
]
std = [
    "burn-core/std",
    "burn-store?/std",
    "burn-nn/std",
    "burn-optim?/std",
    "burn-autodiff?/std",
]
tracing = [
    "cubecl?/tracing",
    "burn-core/tracing",
    "burn-vision?/tracing",
    "burn-nn/tracing",
    "burn-optim?/tracing",
]


network = ["burn-core/network"]

# Training with full features
train = ["burn-train", "autodiff", "dataset"]

## Includes the Text UI (progress bars, metric plots)
tui = ["burn-train?/tui"]

##  Includes system info metrics (CPU/GPU usage, etc)
metrics = ["burn-train?/sys-metrics"]

# Datasets
dataset = ["burn-core/dataset"]

sqlite = ["burn-core/sqlite"]
sqlite-bundled = ["burn-core/sqlite-bundled"]

# Custom deserializer for Record that is helpful for importing data, such as PyTorch pt files.
record-item-custom-serde = ["burn-core/record-item-custom-serde"]

# Model storage and serialization (SafeTensors, PyTorch interop)
store = ["burn-store"]

# Enable safetensors in burn-store.
safetensors = ["store", "burn-store?/safetensors"]
# Enable pytorch in burn-store.
pytorch = ["store", "burn-store?/pytorch"]

# CubeCL re-export
cubecl = ["dep:cubecl"]

audio = ["burn-core/audio"]
vision = ["burn-core/vision", "burn-vision"]
rl = ["dep:burn-rl", "burn-train?/rl"]

# Optimizer
optim = ["burn-optim", "autodiff"]

# Backend
ir = ["burn-ir"]
autodiff = ["burn-core/autodiff", "burn-autodiff"]
fusion = ["ir", "burn-core/fusion", "burn-vision?/fusion"]

## Backend features
accelerate = ["burn-candle?/accelerate", "burn-ndarray?/blas-accelerate"]
autotune = ["burn-core/autotune"]
autotune-checks = ["burn-core/autotune-checks"]
blas-netlib = ["burn-ndarray?/blas-netlib"]
openblas = ["burn-ndarray?/blas-openblas"]
openblas-system = ["burn-ndarray?/blas-openblas-system"]
simd = ["burn-ndarray?/simd", "burn-flex?/simd"]

# burn-flex opt-in CPU codegen paths.
x86-v4 = ["burn-flex?/x86-v4"]
apple-amx = ["burn-flex?/apple-amx"]

template = ["burn-wgpu?/template"]
distributed = [
    "std",
    "burn-core/distributed",
    "burn-optim/distributed",
    "burn-train?/ddp",
]
# TODO: add to burn dispatch
remote = ["burn-remote/client", "ir", "burn-core/remote"]
router = ["burn-router", "ir"]
server = ["burn-core/server"]

candle = ["burn-candle"]
candle-cuda = ["candle", "burn-candle/cuda"]
candle-metal = ["burn-candle?/metal"]
cuda = ["burn-cuda", "burn-core/cuda", "burn-vision?/cubecl-backend"]
rocm = ["burn-rocm", "burn-core/rocm", "burn-vision?/cubecl-backend"]
flex = ["burn-flex", "burn-core/flex", "burn-vision?/flex"]
ndarray = ["burn-ndarray", "burn-core/ndarray"]
tch = ["burn-tch", "burn-core/tch"]
vulkan = ["wgpu", "burn-core/vulkan"]
webgpu = ["wgpu", "burn-core/webgpu"]
metal = ["wgpu", "burn-core/metal"]
wgpu = ["burn-wgpu", "burn-core/wgpu", "burn-vision?/cubecl-backend"]
cpu = ["burn-cpu", "burn-core/cpu", "burn-vision?/cubecl-backend"]

# Backend extensions
extension = ["burn-core/extension"]

[dependencies]

# ** Please make sure all dependencies support no_std when std is disabled **

burn-core = { workspace = true }
burn-train = { workspace = true, optional = true }
burn-store = { workspace = true, optional = true }
burn-nn = { workspace = true }
burn-optim = { workspace = true, optional = true }
burn-rl = { workspace = true, optional = true }
burn-vision = { workspace = true, optional = true }
burn-std = { workspace = true }

# Backends
# TODO: clean up from root; backends should be exposed from the extension
burn-candle = { workspace = true, optional = true, features = ["default"] }
burn-cuda = { workspace = true, optional = true }
burn-cpu = { workspace = true, optional = true }
burn-rocm = { workspace = true, optional = true }
burn-flex = { workspace = true, optional = true }
burn-ndarray = { workspace = true, optional = true }
burn-remote = { workspace = true, optional = true }
burn-router = { workspace = true, optional = true }
burn-tch = { workspace = true, optional = true }
burn-wgpu = { workspace = true, optional = true }
burn-ir = { workspace = true, optional = true }
burn-autodiff = { workspace = true, optional = true }
burn-dispatch = { workspace = true, optional = true }

cubecl = { workspace = true, optional = true }
