diff src/LazyTensors/LazyTensors.jl @ 1788:8b64df6cadba refactor/lazy_tensors/elementwise_ops

Refactor ElementWiseOperation to give a flatter structure of tensor compositions improving type inference
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 25 Sep 2024 10:25:30 +0200
parents a922aa69eb83
children b8cb38fd67ff
line wrap: on
line diff
--- a/src/LazyTensors/LazyTensors.jl	Fri Sep 13 22:41:27 2024 +0200
+++ b/src/LazyTensors/LazyTensors.jl	Wed Sep 25 10:25:30 2024 +0200
@@ -25,7 +25,7 @@
 Base.:*(a::LazyTensor, args::Union{LazyTensor, AbstractArray}...) = foldr(*,(a,args...))
 
 # Addition and subtraction of lazy tensors
-Base.:+(s::LazyTensor, t::LazyTensor) = ElementwiseTensorOperation{:+}(s,t)
+Base.:+(ts::LazyTensor...) = ElementwiseTensorOperation{:+}(ts...)
 Base.:-(s::LazyTensor, t::LazyTensor) = ElementwiseTensorOperation{:-}(s,t)
 
 # Composing lazy tensors