comparison src/LazyTensors/tuple_manipulation.jl @ 1228:73f262a0a384 refactor/LazyTensors/tuple_manipulation

Add @inline to definition of split_tuple
author Jonatan Werpers <jonatan@werpers.com>
date Sun, 19 Feb 2023 11:41:40 +0100
parents 06b983f0d236
children 8f4259fbd39c
comparison
equal deleted inserted replaced
1227:06b983f0d236 1228:73f262a0a384
37 ```julia 37 ```julia
38 split_tuple((1,2,3,4,5,6), (3,1,2)) -> (1,2,3),(4,),(5,6) 38 split_tuple((1,2,3,4,5,6), (3,1,2)) -> (1,2,3),(4,),(5,6)
39 ``` 39 ```
40 """ 40 """
41 function split_tuple(t, szs) 41 function split_tuple(t, szs)
42 @inline
42 if length(t) != sum(szs; init=0) 43 if length(t) != sum(szs; init=0)
43 throw(ArgumentError("length(t) must equal sum(szs)")) 44 throw(ArgumentError("length(t) must equal sum(szs)"))
44 end 45 end
45 46
46 rs = sizes_to_ranges(szs) 47 rs = sizes_to_ranges(szs)