Mercurial > repos > public > sbplib_julia
comparison test/LazyTensors/tuple_manipulation_test.jl @ 1229:8f4259fbd39c refactor/LazyTensors/tuple_manipulation
Simplify split_index
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 19 Feb 2023 11:43:29 +0100 |
parents | 73f262a0a384 |
children | de6a9635f293 |
comparison
equal
deleted
inserted
replaced
1228:73f262a0a384 | 1229:8f4259fbd39c |
---|---|
1 using Test | 1 using Test |
2 using Sbplib.LazyTensors | 2 using Sbplib.LazyTensors |
3 | 3 |
4 @testset "split_index" begin | 4 @testset "split_index" begin |
5 @test LazyTensors.split_index(Val(2),Val(1),Val(2),Val(2),1,2,3,4,5,6) == ((1,2,:,5,6),(3,4)) | 5 @test LazyTensors.split_index(2,1,2,2, 1,2,3,4,5,6) == ((1,2,:,5,6),(3,4)) |
6 @test LazyTensors.split_index(Val(2),Val(3),Val(2),Val(2),1,2,3,4,5,6) == ((1,2,:,:,:,5,6),(3,4)) | 6 @test LazyTensors.split_index(2,3,2,2, 1,2,3,4,5,6) == ((1,2,:,:,:,5,6),(3,4)) |
7 @test LazyTensors.split_index(Val(3),Val(1),Val(1),Val(2),1,2,3,4,5,6) == ((1,2,3,:,5,6),(4,)) | 7 @test LazyTensors.split_index(3,1,1,2, 1,2,3,4,5,6) == ((1,2,3,:,5,6),(4,)) |
8 @test LazyTensors.split_index(Val(3),Val(2),Val(1),Val(2),1,2,3,4,5,6) == ((1,2,3,:,:,5,6),(4,)) | 8 @test LazyTensors.split_index(3,2,1,2, 1,2,3,4,5,6) == ((1,2,3,:,:,5,6),(4,)) |
9 @test LazyTensors.split_index(Val(1),Val(1),Val(2),Val(3),1,2,3,4,5,6) == ((1,:,4,5,6),(2,3)) | 9 @test LazyTensors.split_index(1,1,2,3, 1,2,3,4,5,6) == ((1,:,4,5,6),(2,3)) |
10 @test LazyTensors.split_index(Val(1),Val(2),Val(2),Val(3),1,2,3,4,5,6) == ((1,:,:,4,5,6),(2,3)) | 10 @test LazyTensors.split_index(1,2,2,3, 1,2,3,4,5,6) == ((1,:,:,4,5,6),(2,3)) |
11 | 11 |
12 @test LazyTensors.split_index(Val(0),Val(1),Val(3),Val(3),1,2,3,4,5,6) == ((:,4,5,6),(1,2,3)) | 12 @test LazyTensors.split_index(0,1,3,3, 1,2,3,4,5,6) == ((:,4,5,6),(1,2,3)) |
13 @test LazyTensors.split_index(Val(3),Val(1),Val(3),Val(0),1,2,3,4,5,6) == ((1,2,3,:),(4,5,6)) | 13 @test LazyTensors.split_index(3,1,3,0, 1,2,3,4,5,6) == ((1,2,3,:),(4,5,6)) |
14 | 14 |
15 @inferred LazyTensors.split_index(Val(2),Val(3),Val(2),Val(2),1,2,3,2,2,4) | 15 split_index_static(::Val{dim_before}, ::Val{dim_view}, ::Val{dim_index}, ::Val{dim_after}, I...) where {dim_before,dim_view,dim_index,dim_after} = LazyTensors.split_index(dim_before, dim_view, dim_index, dim_after, I...) |
16 @inferred split_index_static(Val(2),Val(3),Val(2),Val(2),1,2,3,2,2,4) | |
16 end | 17 end |
17 | 18 |
18 @testset "split_tuple" begin | 19 @testset "split_tuple" begin |
19 @testset "general" begin | 20 @testset "general" begin |
20 @test LazyTensors.split_tuple((),()) == () | 21 @test LazyTensors.split_tuple((),()) == () |