[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-core"
edition.workspace = true
keywords = ["deep-learning", "machine-learning", "tensor", "pytorch", "ndarray"]
license.workspace = true
name = "burn-core"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-core"
version.workspace = true

[lints]
workspace = true

[features]
default = [
    "std",
    "burn-std/default",
    "burn-dataset?/default",
    "burn-tensor/default",
]
doc = [
    "std",
    "dataset",
    "audio",
    # Doc features
    "burn-std/doc",
    "burn-dataset/doc",
    "burn-tensor/doc",
]
tracing = ["burn-std/tracing", "burn-tensor/tracing", "burn-dataset?/tracing"]

dataset = ["burn-dataset"]

network = ["burn-std/network"]
sqlite = ["burn-dataset?/sqlite"]
sqlite-bundled = ["burn-dataset?/sqlite-bundled"]
std = [
    "bincode/std",
    "burn-std/std",
    "burn-tensor/std",
    "flate2",
    "half/std",
    "log",
    "rand/std",
    "rmp-serde",
    "serde/std",
    "serde_json/std",
    "num-traits/std",
]
vision = ["burn-dataset?/vision"]
audio = ["burn-dataset?/audio"]
distributed = ["std", "burn-tensor/distributed"]

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

# Backends
remote = ["burn-tensor/remote"]
server = ["burn-tensor/server"]
cuda = ["burn-tensor/cuda"]
rocm = ["burn-tensor/rocm"]
flex = ["burn-tensor/flex"]
ndarray = ["burn-tensor/ndarray"]
tch = ["burn-tensor/tch"]
vulkan = ["burn-tensor/vulkan"]
webgpu = ["burn-tensor/webgpu"]
wgpu = ["burn-tensor/wgpu"]
metal = ["burn-tensor/metal"]
cpu = ["burn-tensor/cpu"]
autodiff = ["burn-tensor/autodiff"]
ir = ["burn-ir"]

# Backend features
autotune = ["burn-tensor/autotune"]
autotune-checks = ["burn-tensor/autotune-checks"]
fusion = ["burn-tensor/fusion"]

# Backend extensions
# burn-dispatch features are enabled from burn-tensor, we just re-export the public types
extension = ["burn-tensor/extension", "burn-backend-extension", "burn-dispatch", "burn-backend"]

[dependencies]

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

burn-std = { workspace = true }
burn-dataset = { workspace = true, optional = true }
burn-derive = { workspace = true }
burn-tensor = { workspace = true }

# Backend extensions
burn-backend = { workspace = true, optional = true }
burn-dispatch = { workspace = true, optional = true }
burn-backend-extension = { workspace = true, optional = true }
burn-ir = { workspace = true, optional = true }

data-encoding = { workspace = true }
uuid = { workspace = true }

derive-new = { workspace = true }
log = { workspace = true, optional = true }
rand = { workspace = true }

# The same implementation of HashMap in std but with no_std support (only alloc crate is needed)
hashbrown = { workspace = true, features = ["serde"] } # no_std compatible

# Serialize Deserialize
flate2 = { workspace = true, optional = true }
serde = { workspace = true, features = ["derive"] }

ahash = { workspace = true }
bincode = { workspace = true }
half = { workspace = true }
num-traits = { workspace = true }
rmp-serde = { workspace = true, optional = true }
serde_json = { workspace = true, features = ["alloc"] } #Default enables std
spin = { workspace = true }                             # Using in place of use std::sync::Mutex when std is disabled
thiserror = { workspace = true, optional = true }

[target.'cfg(target_has_atomic = "ptr")'.dependencies]
regex = { workspace = true }

[target.'cfg(not(target_has_atomic = "ptr"))'.dependencies]
portable-atomic-util = { workspace = true }
portable-atomic = { workspace = true }

[dev-dependencies]
burn-dataset = { workspace = true, features = ["fake"] }
rstest = { workspace = true }
serial_test = { workspace = true }

# Default device for tests
burn-tensor = { workspace = true, features = ["ndarray"] }

[package.metadata.docs.rs]
features = ["doc"]
rustdoc-args = ["--cfg", "docsrs"]
