Skip to content

Commit 5db33c5

Browse files
kshyattlkdvos
andauthored
Update src/tensors/tensoroperations.jl
Co-authored-by: Lukas Devos <ldevos98@gmail.com>
1 parent 797946c commit 5db33c5

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

src/tensors/tensoroperations.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ function TO.tensoradd_type(TC, A::AdjointBlockTensorMap, pA::Index2Tuple, conjA:
1515
return TO.tensoradd_type(TC, A', adjointtensorindices(A, pA), !conjA)
1616
end
1717

18-
# copy blocks back to CPU/collect them into an array
19-
# seems necessary for GPU-backed BlockTensorMaps but
20-
# maybe not the most efficient approach?
2118
function TO.tensorscalar(t::AbstractBlockTensorMap{T, S, 0, 0}) where {T, S}
22-
return prod(TO.tensorscalar, nonzero_values(t))
19+
return nonzero_length(t) == 0 ? zero(T) : TO.tensorscalar(only(nonzero_values(t)))
2320
end
2421

2522
# tensoralloc_contract

0 commit comments

Comments
 (0)