comparison src/LazyTensors/lazy_tensor_operations.jl @ 1880:378002c78e86 refactor/lazy_tensors/elementwise_ops

Add implementation of apply_transpose to TensorSum
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 27 Jan 2025 17:11:31 +0100
parents 765f42559c47
children ed50eec18365
comparison
equal deleted inserted replaced
1879:765f42559c47 1880:378002c78e86
99 end 99 end
100 100
101 function apply(tmBinOp::TensorSum{T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg{Any,R}) where {T,R,D} 101 function apply(tmBinOp::TensorSum{T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg{Any,R}) where {T,R,D}
102 vs = map(tmBinOp.tms) do tm 102 vs = map(tmBinOp.tms) do tm
103 apply(tm,v,I...) 103 apply(tm,v,I...)
104 end
105
106 return +(vs...)
107 end
108
109 function apply_transpose(tmBinOp::TensorSum{T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg{Any,R}) where {T,R,D}
110 vs = map(tmBinOp.tms) do tm
111 apply_transpose(tm,v,I...)
104 end 112 end
105 113
106 return +(vs...) 114 return +(vs...)
107 end 115 end
108 116