Skip to content

Commit

Permalink
fix: correctly handle scalar tensors in TensorRefMut::from_raw
Browse files Browse the repository at this point in the history
  • Loading branch information
decahedron1 committed Dec 26, 2024
1 parent 9b08ef4 commit 73eb1d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/value/impl_tensor/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ impl<'a, T: PrimitiveTensorElementType + Debug> TensorRefMut<'a, T> {
let shape_ptr: *const i64 = shape.as_ptr();
let shape_len = shape.len();

let data_len = shape.iter().product::<i64>() as usize * std::mem::size_of::<T>();
let data_len = calculate_tensor_size(&shape) * std::mem::size_of::<T>();

ortsys![
unsafe CreateTensorWithDataAsOrtValue(
Expand Down

0 comments on commit 73eb1d8

Please sign in to comment.