Mercurial > repos > public > sbplib_julia
comparison src/LazyTensors/lazy_tensor_operations.jl @ 1015:4dd3c2312d9e refactor/lazy_tensors
Fix some @boundscheck @inboudns combos
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 21 Mar 2022 13:11:37 +0100 |
parents | f7a718bcb4da |
children | 5c8c148c56a3 |
comparison
equal
deleted
inserted
replaced
1013:56fe037641ef | 1015:4dd3c2312d9e |
---|---|
19 end | 19 end |
20 end | 20 end |
21 | 21 |
22 function Base.getindex(ta::LazyTensorApplication{T,R}, I::Vararg{Any,R}) where {T,R} | 22 function Base.getindex(ta::LazyTensorApplication{T,R}, I::Vararg{Any,R}) where {T,R} |
23 @boundscheck checkbounds(ta, Int.(I)...) | 23 @boundscheck checkbounds(ta, Int.(I)...) |
24 return apply(ta.t, ta.o, I...) | 24 return @inbounds apply(ta.t, ta.o, I...) |
25 end | 25 end |
26 Base.getindex(ta::LazyTensorApplication{T,1} where T, I::CartesianIndex{1}) = ta[Tuple(I)...] # Would otherwise be caught in the previous method. | 26 Base.@propagate_inbounds @Base.getindex(ta::LazyTensorApplication{T,1} where T, I::CartesianIndex{1}) = ta[Tuple(I)...] # Would otherwise be caught in the previous method. |
27 Base.size(ta::LazyTensorApplication) = range_size(ta.t) | 27 Base.size(ta::LazyTensorApplication) = range_size(ta.t) |
28 | 28 |
29 | 29 |
30 """ | 30 """ |
31 LazyTensorTranspose{T,R,D} <: LazyTensor{T,D,R} | 31 LazyTensorTranspose{T,R,D} <: LazyTensor{T,D,R} |