Mercurial > repos > public > sbplib_julia
changeset 1003:7ef605b8f132 refactor/lazy_tensors
Remove a bunch of todos
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 20 Mar 2022 21:19:00 +0100 |
parents | 271aa6ae1055 |
children | 7fd37aab84fe |
files | src/LazyTensors/lazy_array.jl src/LazyTensors/lazy_tensor.jl test/LazyTensors/lazy_array_test.jl |
diffstat | 3 files changed, 0 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/LazyTensors/lazy_array.jl Fri Mar 18 22:18:04 2022 +0100 +++ b/src/LazyTensors/lazy_array.jl Sun Mar 20 21:19:00 2022 +0100 @@ -61,7 +61,6 @@ end LazyElementwiseOperation{T,D,Op}(a::AbstractArray{T,D},b::T) where {T,D,Op} = LazyElementwiseOperation{T,D,Op}(a, LazyConstantArray(b, size(a))) LazyElementwiseOperation{T,D,Op}(a::T,b::AbstractArray{T,D}) where {T,D,Op} = LazyElementwiseOperation{T,D,Op}(LazyConstantArray(a, size(b)), b) -# TODO: Move Op to be the first parameter? Compare to Binary operations Base.size(v::LazyElementwiseOperation) = size(v.a) @@ -70,11 +69,6 @@ evaluate(leo::LazyElementwiseOperation{T,D,:*}, I::Vararg{Int,D}) where {T,D} = leo.a[I...] * leo.b[I...] evaluate(leo::LazyElementwiseOperation{T,D,:/}, I::Vararg{Int,D}) where {T,D} = leo.a[I...] / leo.b[I...] -# TODO: Make sure boundschecking is done properly and that the lenght of the vectors are equal -# NOTE: Boundschecking in getindex functions now assumes that the size of the -# vectors in the LazyElementwiseOperation are the same size. If we remove the -# size assertion in the constructor we might have to handle -# boundschecking differently. Base.@propagate_inbounds @inline function Base.getindex(leo::LazyElementwiseOperation{T,D}, I::Vararg{Int,D}) where {T,D} @boundscheck if !checkbounds(Bool, leo.a, I...) throw(BoundsError([leo], I...))
--- a/src/LazyTensors/lazy_tensor.jl Fri Mar 18 22:18:04 2022 +0100 +++ b/src/LazyTensors/lazy_tensor.jl Sun Mar 20 21:19:00 2022 +0100 @@ -77,4 +77,3 @@ """ Base.eltype(::LazyTensor{T}) where T = T -# TODO: Think about boundschecking!
--- a/test/LazyTensors/lazy_array_test.jl Fri Mar 18 22:18:04 2022 +0100 +++ b/test/LazyTensors/lazy_array_test.jl Sun Mar 20 21:19:00 2022 +0100 @@ -59,8 +59,6 @@ end @test_throws BoundsError (v1 +̃ v2)[4] v2 = [1., 2, 3, 4] - # Test that size of arrays is asserted when not specified inbounds - # TODO: Replace these errors with SizeMismatch @test_throws DimensionMismatch v1 +̃ v2 # Test operations on LazyArray @@ -76,8 +74,6 @@ end @test_throws BoundsError (v1 + v2)[4] v2 = [1., 2, 3, 4] - # Test that size of arrays is asserted when not specified inbounds - # TODO: Replace these errors with SizeMismatch @test_throws DimensionMismatch v1 + v2 end