Mercurial > repos > public > sbplib_julia
comparison src/LazyTensors/lazy_tensor_operations.jl @ 2086:53e5887457b9
Merge bugfix/lazy_tensors/tensor_sum_inference
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Mon, 02 Mar 2026 13:51:56 +0100 |
| parents | 51a005910f19 |
| children |
comparison
equal
deleted
inserted
replaced
| 2079:118c09b168f5 | 2086:53e5887457b9 |
|---|---|
| 97 D = domain_dim(ts[1]) | 97 D = domain_dim(ts[1]) |
| 98 return TensorSum{T,R,D}(ts) | 98 return TensorSum{T,R,D}(ts) |
| 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 return sum(tmBinOp.tms) do tm | 102 vs = map(tmBinOp.tms) do tm |
| 103 apply(tm,v,I...) | 103 apply(tm,v,I...) |
| 104 end | 104 end |
| 105 | |
| 106 return +(vs...) | |
| 105 end | 107 end |
| 106 | 108 |
| 107 function apply_transpose(tmBinOp::TensorSum{T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg{Any,R}) where {T,R,D} | 109 function apply_transpose(tmBinOp::TensorSum{T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg{Any,R}) where {T,R,D} |
| 108 return sum(tmBinOp.tms) do tm | 110 vs = map(tmBinOp.tms) do tm |
| 109 apply_transpose(tm,v,I...) | 111 apply_transpose(tm,v,I...) |
| 110 end | 112 end |
| 113 | |
| 114 return +(vs...) | |
| 111 end | 115 end |
| 112 | 116 |
| 113 range_size(tmBinOp::TensorSum) = range_size(tmBinOp.tms[1]) | 117 range_size(tmBinOp::TensorSum) = range_size(tmBinOp.tms[1]) |
| 114 domain_size(tmBinOp::TensorSum) = domain_size(tmBinOp.tms[1]) | 118 domain_size(tmBinOp::TensorSum) = domain_size(tmBinOp.tms[1]) |
| 115 | 119 |
