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
//! An unofficial, eager-first Rust frontend for LibTorch.
//!
//! RustTorch provides fallible neural-network modules, optimizer builders,
//! SafeTensors state exchange, and an optional inspectable graph API. Numerical
//! operations and automatic differentiation remain delegated to [`tch`] and
//! the linked LibTorch runtime.
//!
//! # Quick start
//!
//! ```no_run
//! use rusttorch::nn::Sequential;
//! use rusttorch::{DeviceSpec, Kind, Result, Tensor};
//!
//! fn main() -> Result<()> {
//! let model = Sequential::builder()
//! .linear(2, 4)
//! .relu()
//! .linear(4, 1)
//! .build(DeviceSpec::Auto)?;
//! let input = Tensor::f_zeros([8, 2], (Kind::Float, model.device()))?;
//! let output = model.forward(&input)?;
//! assert_eq!(output.size(), [8, 1]);
//! Ok(())
//! }
//! ```
//!
//! Explicit backend requests fail when unavailable; use [`DeviceSpec::Auto`]
//! only when selecting the best available backend is desired. Model weights
//! are exchanged through `.safetensors` files rather than Python pickle files.
pub use ;
pub use ;
pub use ;