changeset 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
files src/LazyTensors/tuple_manipulation.jl test/LazyTensors/tuple_manipulation_test.jl
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/LazyTensors/tuple_manipulation.jl	Sat Feb 18 21:56:29 2023 +0100
+++ b/src/LazyTensors/tuple_manipulation.jl	Sun Feb 19 11:41:40 2023 +0100
@@ -39,6 +39,7 @@
 ```
 """
 function split_tuple(t, szs)
+    @inline
     if length(t) != sum(szs; init=0)
         throw(ArgumentError("length(t) must equal sum(szs)"))
     end
--- a/test/LazyTensors/tuple_manipulation_test.jl	Sat Feb 18 21:56:29 2023 +0100
+++ b/test/LazyTensors/tuple_manipulation_test.jl	Sun Feb 19 11:41:40 2023 +0100
@@ -34,10 +34,9 @@
         @test_throws ArgumentError(err_msg) LazyTensors.split_tuple((1,2), (1))
 
 
-        split_tuple_static(t, ::Val{SZS}) where {SZS} = @inline LazyTensors.split_tuple(t,SZS)
+        split_tuple_static(t, ::Val{SZS}) where {SZS} = LazyTensors.split_tuple(t,SZS)
 
         @inferred split_tuple_static((1,2,3,4,5,6), Val((3,1,2)))
-
         @inferred split_tuple_static((1,2,3,4),Val((3,1)))
         @inferred split_tuple_static((1,2,true,4),Val((3,1)))
         @inferred split_tuple_static((1,2,3,4,5,6),Val((3,2,1)))