mirror of
https://github.com/huggingface/candle.git
synced 2025-06-19 03:54:56 +00:00
Add the slice indexing.
This commit is contained in:
@ -9,5 +9,7 @@ fn add() -> Result<()> {
|
||||
let tensor = Tensor::new([3f32, 1., 4.].as_slice(), Device::Cpu)?;
|
||||
let dim1 = tensor.shape().r1()?;
|
||||
assert_eq!(dim1, 3);
|
||||
let content: Vec<f32> = tensor.to_vec1()?;
|
||||
assert_eq!(content, [3., 1., 4.]);
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user