mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 18:48:51 +00:00
Use the same default as pytorch for sum. (#164)
This commit is contained in:
@ -7,9 +7,9 @@ use candle::{Device, Tensor};
|
||||
fn main() -> Result<()> {
|
||||
let device = Device::new_cuda(0)?;
|
||||
let t = Tensor::new(&[[1f32, 2., 3., 4.2]], &device)?;
|
||||
let sum = t.sum(&[0])?;
|
||||
let sum = t.sum_keepdim(&[0])?;
|
||||
println!("{sum}");
|
||||
let sum = t.sum(&[1])?;
|
||||
let sum = t.sum_keepdim(&[1])?;
|
||||
println!("{sum}");
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user