[package]
authors = ["nathanielsimard <nathaniel.simard.42@gmail.com>"]
categories = ["science", "no-std", "embedded", "wasm"]
description = "Ndarray backend for the Burn framework"
documentation = "https://docs.rs/burn-ndarray"
edition.workspace = true
keywords = ["deep-learning", "machine-learning", "data"]
license.workspace = true
name = "burn-ndarray"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-ndarray"
version.workspace = true

[lints]
workspace = true

[features]
blas-accelerate = [
    "blas-src/accelerate", # Accelerate framework (macOS only)
    "ndarray/blas",
]
blas-netlib = ["blas-src/netlib", "ndarray/blas"]
blas-openblas = ["blas-src/openblas", "ndarray/blas", "openblas-src"]
blas-openblas-system = [
    "blas-src/openblas",
    "ndarray/blas",
    "openblas-src/system",
]
default = ["std", "simd", "multi-threads"]
doc = ["default"]
multi-threads = [
    "rayon",
    "ndarray/rayon",
    "matrixmultiply/threading",
]
simd = ["macerator", "bytemuck", "seq-macro", "itertools"]
std = [
    "burn-autodiff",
    "burn-std/std",
    "burn-backend/std",
    "burn-ir/std",
    "ndarray/std",
    "matrixmultiply/std",
    "rand/std",
    "rand/std_rng",
    "num-traits/std",
    "macerator/std",
]
tracing = [
    "burn-autodiff?/tracing",
    "burn-std/tracing",
    "burn-backend/tracing",
    "burn-ir/tracing",
]

# Serves as a ref impl for some burn-cubecl kernels
export_tests = []

[dependencies]

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

burn-autodiff = { workspace = true, optional = true }
burn-std = { workspace = true }
burn-ir = { workspace = true }
burn-backend = { workspace = true }

atomic_float = { workspace = true }
blas-src = { workspace = true, default-features = false, optional = true }      # no-std compatible
const-random = { workspace = true }
libm = { workspace = true }
matrixmultiply = { workspace = true, default-features = false }
ndarray = { workspace = true }
num-traits = { workspace = true }
openblas-src = { workspace = true, optional = true }
paste = { workspace = true }
rand = { workspace = true, default-features = false }

# SIMD
bytemuck = { workspace = true, optional = true }
itertools = { version = "0.14", optional = true }
macerator = { workspace = true, optional = true }
seq-macro = { version = "0.3", optional = true }

# Parallel
rayon = { workspace = true, optional = true }

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

[dev-dependencies]
bytes = { workspace = true }

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