Registry / other / candle-nn

candle-nn

JSON →
library0.9.2rscratesunverified

Minimalist ML framework providing neural network building blocks for the Candle machine learning library.

# Cargo.toml [dependencies] candle-nn = "0.9.2"
INSTALL
IMPORT
SIG · CANDLE-NN
C
candle-nn
otherrustv0.9.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Linear
use candle_nn::Linear;

Creates a linear layer and applies it to random input.

use candle_nn::{Linear, Module, VarBuilder}; use candle_core::{Device, Tensor}; let device = Device::Cpu; let vb = VarBuilder::new(0, candle_core::DType::F32, &device); let linear = Linear::new(10, 5, vb.pp("linear")).unwrap(); let input = Tensor::randn(0f32, 1.0, (3, 10), &device).unwrap(); let output = linear.forward(&input).unwrap();
Debug
Known issues
gotchaRequires the `candle-core` crate and a device (CPU/GPU) to be specified.
fix
Add `candle-core` to dependencies and initialize a device before using `candle-nn`.
affects: >=0.9.0
Upgrade
Version history
0.9.2latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
6
Meta
1
Amazon
1
Resources
candle-nn — cargo add candle-nn · libregistry