Mercurial > repos > public > sbplib_julia
comparison src/LazyTensors/lazy_tensor_operations.jl @ 482:f0f272666a64 feature/compose_identity_mappings
Fix some errors in SizeMismatch exception
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 05 Nov 2020 10:28:07 +0100 |
parents | 2fde16253a84 |
children | d5032c58c67a |
comparison
equal
deleted
inserted
replaced
481:2fde16253a84 | 482:f0f272666a64 |
---|---|
98 end | 98 end |
99 end | 99 end |
100 | 100 |
101 struct SizeMismatch <: Exception | 101 struct SizeMismatch <: Exception |
102 tm::TensorMapping | 102 tm::TensorMapping |
103 sz::NTuple{N,Int} | 103 sz |
104 end | 104 end |
105 | 105 |
106 function showerror(io::IO, err::SizeMismatch) | 106 function showerror(io::IO, err::SizeMismatch) |
107 print(io, "SizeMismatch: ") | 107 print(io, "SizeMismatch: ") |
108 print(io, "attempt to apply TensorMapping with domain size $(domain_size(tm)) to a domain of size $sz") | 108 print(io, "attempt to apply TensorMapping with domain size $(domain_size(err.tm)) to a domain of size $(err.sz)") |
109 end | 109 end |
110 | 110 |
111 | 111 |
112 range_size(tm::TensorMappingComposition) = range_size(tm.t1) | 112 range_size(tm::TensorMappingComposition) = range_size(tm.t1) |
113 domain_size(tm::TensorMappingComposition) = domain_size(tm.t2) | 113 domain_size(tm::TensorMappingComposition) = domain_size(tm.t2) |