#[cfg(feature = "ml_train")]
use burn::tensor::DType;
#[cfg(feature = "ml_store_precision_full")]
use burn::record::FullPrecisionSettings;
#[cfg(feature = "ml_store_precision_half")]
use burn::record::HalfPrecisionSettings;
#[cfg(all(feature = "ml_train", feature = "ml_train_precision_fp32", feature = "ml_train_precision_fp16"))]
compile_error!("`ml_train_precision_fp32` and `ml_train_precision_fp16` cannot be enabled together.");
#[cfg(all(feature = "ml_train", feature = "ml_train_precision_fp32", feature = "ml_train_precision_bf16"))]
compile_error!("`ml_train_precision_fp32` and `ml_train_precision_bf16` cannot be enabled together.");
#[cfg(all(feature = "ml_train", feature = "ml_train_precision_fp16", feature = "ml_train_precision_bf16"))]
compile_error!("`ml_train_precision_fp16` and `ml_train_precision_bf16` cannot be enabled together.");
#[cfg(all(
feature = "ml_train",
not(any(feature = "ml_train_precision_fp32", feature = "ml_train_precision_fp16", feature = "ml_train_precision_bf16",))
))]
compile_error!("No ML training precision feature enabled; enable exactly one of `ml_train_precision_fp32`, `ml_train_precision_fp16`, or `ml_train_precision_bf16`.");
#[cfg(all(feature = "ml_ndarray", any(feature = "ml_train_precision_fp16", feature = "ml_train_precision_bf16")))]
compile_error!("The NdArray backend only supports `ml_train_precision_fp32` for training. Choose a GPU backend for reduced precision training.");
#[cfg(all(feature = "ml_store_precision_full", feature = "ml_store_precision_half"))]
compile_error!("`ml_store_precision_full` and `ml_store_precision_half` cannot be enabled together.");
#[cfg(not(any(feature = "ml_store_precision_full", feature = "ml_store_precision_half")))]
compile_error!("No ML storage precision feature enabled; enable exactly one of `ml_store_precision_full` or `ml_store_precision_half`.");
#[cfg(all(feature = "ml_train", feature = "ml_train_precision_fp32"))]
pub type PrecisionElement = f32;
#[cfg(all(feature = "ml_train", feature = "ml_train_precision_fp16"))]
pub type PrecisionElement = burn::tensor::f16;
#[cfg(all(feature = "ml_train", feature = "ml_train_precision_bf16"))]
pub type PrecisionElement = burn::tensor::bf16;
#[cfg(all(feature = "ml_train", feature = "ml_train_precision_fp32"))]
pub const PRECISION_DTYPE: DType = DType::F32;
#[cfg(all(feature = "ml_train", feature = "ml_train_precision_fp16"))]
pub const PRECISION_DTYPE: DType = DType::F16;
#[cfg(all(feature = "ml_train", feature = "ml_train_precision_bf16"))]
pub const PRECISION_DTYPE: DType = DType::BF16;
#[cfg(feature = "ml_store_precision_full")]
pub type StorePrecisionSettings = FullPrecisionSettings;
#[cfg(feature = "ml_store_precision_half")]
pub type StorePrecisionSettings = HalfPrecisionSettings;