diff src/LazyTensors/lazy_tensor_operations.jl @ 1007:f7a718bcb4da refactor/lazy_tensors

Add checking of sizes to LazyTensorBinaryOperation
author Jonatan Werpers <jonatan@werpers.com>
date Sun, 20 Mar 2022 22:41:28 +0100
parents d9476fede83d
children 2c1a0722ddb9 4dd3c2312d9e 52f07c77299d
line wrap: on
line diff
--- a/src/LazyTensors/lazy_tensor_operations.jl	Sun Mar 20 22:22:32 2022 +0100
+++ b/src/LazyTensors/lazy_tensor_operations.jl	Sun Mar 20 22:41:28 2022 +0100
@@ -1,5 +1,3 @@
-# TODO: Go over type parameters
-
 """
     LazyTensorApplication{T,R,D} <: LazyArray{T,R}
 
@@ -59,10 +57,11 @@
     tm2::T2
 
     function LazyTensorBinaryOperation{Op,T,R,D}(tm1::T1,tm2::T2) where {Op,T,R,D, T1<:LazyTensor{T,R,D},T2<:LazyTensor{T,R,D}}
+        @boundscheck check_domain_size(tm2, domain_size(tm1))
+        @boundscheck check_range_size(tm2, range_size(tm1))
         return new{Op,T,R,D,T1,T2}(tm1,tm2)
     end
 end
-# TODO: Boundschecking in constructor.
 
 LazyTensorBinaryOperation{Op}(s,t) where Op = LazyTensorBinaryOperation{Op,eltype(s), range_dim(s), domain_dim(s)}(s,t)