mirror of
https://github.com/hanzoai/ml.git
synced 2026-11-20 22:46:50 +00:00
Rebased candle 0.10.2 (cudarc 0.19.4, hf-hub 0.5) + uplifted hanzo-kernels (mmvq_gguf.cu, mmq_gguf/, 46 extern launchers); hanzo-engine links green on GB10 sm_121 / CUDA 13. Preserves Vulkan/ROCm/hanzo-ug deltas.
21 lines
566 B
Rust
21 lines
566 B
Rust
#[cfg(feature = "mkl")]
|
|
extern crate intel_mkl_src;
|
|
|
|
#[cfg(feature = "accelerate")]
|
|
extern crate accelerate_src;
|
|
|
|
use anyhow::Result;
|
|
use hanzo_ml::{Device, Tensor};
|
|
|
|
fn main() -> Result<()> {
|
|
let a = Tensor::new(&[[0.0f32, 1.0, 2.0], [3.0, 4.0, 5.0]], &Device::Cpu)?;
|
|
let b = Tensor::new(&[[88.0f32], [99.0]], &Device::Cpu)?;
|
|
let new_a = a.slice_scatter(&b, 1, 2)?;
|
|
assert_eq!(a.to_vec2::<f32>()?, [[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]]);
|
|
assert_eq!(
|
|
new_a.to_vec2::<f32>()?,
|
|
[[0.0, 1.0, 88.0], [3.0, 4.0, 99.0]]
|
|
);
|
|
Ok(())
|
|
}
|