1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! # Tensor Backend
//!
//! This module provides a unified interface for different tensor backends,
//! allowing for batching apis to work in a backend-agnostic manner
//! ## Feature Flags
//!
//! The module uses feature flags to conditionally compile support for different backends:
//!
//! - `candle`: Enables support for the Candle tensor library
//! - `burn`: Enables support for the Burn tensor library
//!
//! ## Usage
//!
//! Users of this crate can work with tensors in a backend-agnostic way by:
//!
//! 1. Importing the traits ([`Backend`], [`Unsqueezable`])
//! 2. Writing code against these trait interfaces
//! 3. Enabling the appropriate feature flag for their desired backend
//!
//! This allows for easy switching between tensor backends without changing application code.
/// Candle tensor backend implementation.
///
/// This module is only available when the `candle` feature flag is enabled.
/// It provides an implementation of the [`Backend`] and [`Unsqueezable`] traits
/// for Candle's `Tensor` type.
///
/// The implementation wraps candle-core's tensor operations to match the
/// expected behavior of our tensor backend abstraction.
/// Burn tensor backend implementation.
///
/// This module is only available when the `burn` feature flag is enabled.
/// It provides an implementation of the [`Backend`] and [`Unsqueezable`] traits
/// for Burn's tensor types.
///
/// Burn uses a different approach to tensors than some other libraries,
/// with stronger compile-time guarantees through its type system.
// Re-export the core traits for convenient imports
pub use *;
/// Mock tensor implementation.
///
/// Operates on simple vector tensors
pub