Compare commits

...

1 Commits

Author SHA1 Message Date
dante
dcdfae93dc fix: empty dim len can be 1 2025-02-28 14:17:00 -05:00
3 changed files with 4 additions and 1 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -1342,9 +1342,11 @@ impl<F: PrimeField + TensorType + PartialOrd + std::hash::Hash> ValTensor<F> {
/// Gets the total number of elements in the tensor
pub fn len(&self) -> usize {
match self {
ValTensor::Value { dims, .. } => {
ValTensor::Value { dims, inner, .. } => {
if !dims.is_empty() && (dims != &[0]) {
dims.iter().product::<usize>()
} else if dims.is_empty() {
inner.inner.len()
} else {
0
}