mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 10:38:54 +00:00
Bugfix for to_scalar (use the proper start offset).
This commit is contained in:
@ -326,7 +326,7 @@ impl Tensor {
|
||||
}
|
||||
let from_cpu_storage = |cpu_storage: &crate::CpuStorage| {
|
||||
let data = S::cpu_storage_as_slice(cpu_storage)?;
|
||||
Ok::<_, Error>(data[0])
|
||||
Ok::<_, Error>(data[self.layout().start_offset()])
|
||||
};
|
||||
match self.storage.as_ref() {
|
||||
Storage::Cpu(cpu_storage) => from_cpu_storage(cpu_storage),
|
||||
|
Reference in New Issue
Block a user