Mercurial > repos > public > sbplib_julia
changeset 1897:ed50eec18365 refactor/lazy_tensors/elementwise_ops
Change implementation of apply to use sum()
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 31 Jan 2025 11:03:09 +0100 |
parents | adc83961cfe9 |
children | 6db6257891ee |
files | src/LazyTensors/lazy_tensor_operations.jl |
diffstat | 1 files changed, 2 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/LazyTensors/lazy_tensor_operations.jl Fri Jan 31 10:58:45 2025 +0100 +++ b/src/LazyTensors/lazy_tensor_operations.jl Fri Jan 31 11:03:09 2025 +0100 @@ -99,19 +99,15 @@ end function apply(tmBinOp::TensorSum{T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg{Any,R}) where {T,R,D} - vs = map(tmBinOp.tms) do tm + return sum(tmBinOp.tms) do tm apply(tm,v,I...) end - - return +(vs...) end function apply_transpose(tmBinOp::TensorSum{T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg{Any,R}) where {T,R,D} - vs = map(tmBinOp.tms) do tm + return sum(tmBinOp.tms) do tm apply_transpose(tm,v,I...) end - - return +(vs...) end range_size(tmBinOp::TensorSum) = range_size(tmBinOp.tms[1])