4
4
from __future__ import annotations
5
5
6
6
import math
7
- import sys
8
7
9
8
import pytest
10
9
import torch
@@ -355,6 +354,7 @@ def test_npe_with_with_iid_embedding_varying_num_trials(trial_factor=50):
355
354
@pytest .mark .parametrize ("num_channels" , (1 , 2 , 3 ))
356
355
@pytest .mark .parametrize ("change_c_mode" , ["conv" , "zeros" ])
357
356
@pytest .mark .parametrize ("n_stages" , [1 , 3 , 4 ])
357
+ @pytest .mark .slow
358
358
def test_2d_ResNet_cnn_embedding_net (
359
359
input_shape , num_channels , change_c_mode , n_stages
360
360
):
@@ -439,24 +439,26 @@ def simulator1d(theta):
439
439
posterior .potential (s )
440
440
441
441
442
- @pytest .mark .parametrize (
443
- "bidirectional" , [True , False ], ids = ["one-directional" , "bi-directional" ]
444
- )
445
442
@pytest .mark .parametrize (
446
443
"mode" ,
447
444
[
448
445
"loop" ,
449
446
pytest .param (
450
447
"scan" ,
451
448
marks = pytest .mark .xfail (
452
- condition = sys . version_info >= ( 3 , 13 ),
453
- reason = "torch.compiler is not yet supported on Python >= 3.13 " ,
449
+ condition = tuple ( map ( int , torch . __version__ . split ( '.' )[: 2 ])) < ( 2 , 5 ),
450
+ reason = "PyTorch's associative_scan only exists for torch >= 2.5 " ,
454
451
strict = True ,
455
452
),
456
453
),
457
454
],
458
455
ids = ["loop" , "scan" ],
459
456
)
457
+ @pytest .mark .parametrize (
458
+ "bidirectional" , [True , False ], ids = ["one-directional" , "bi-directional" ]
459
+ )
460
+ @pytest .mark .slow
461
+ @pytest .mark .filterwarnings ("ignore:Torchinductor" )
460
462
def test_lru_isolated (
461
463
bidirectional : bool ,
462
464
mode : str ,
@@ -497,8 +499,8 @@ def test_lru_isolated(
497
499
pytest .param (
498
500
"scan" ,
499
501
marks = pytest .mark .xfail (
500
- condition = sys . version_info >= ( 3 , 13 ),
501
- reason = "torch.compiler is not yet supported on Python >= 3.13 " ,
502
+ condition = tuple ( map ( int , torch . __version__ . split ( '.' )[: 2 ])) < ( 2 , 5 ),
503
+ reason = "PyTorch's associative_scan only exists for torch >= 2.5 " ,
502
504
strict = True ,
503
505
),
504
506
),
@@ -510,6 +512,8 @@ def test_lru_isolated(
510
512
[True , False ],
511
513
ids = ["input-normalization" , "no-input-normalization" ],
512
514
)
515
+ @pytest .mark .slow
516
+ @pytest .mark .filterwarnings ("ignore:Torchinductor" )
513
517
def test_lru_block_isolated (
514
518
bidirectional : bool ,
515
519
mode : str ,
@@ -555,8 +559,8 @@ def test_lru_block_isolated(
555
559
pytest .param (
556
560
"scan" ,
557
561
marks = pytest .mark .xfail (
558
- condition = sys . version_info >= ( 3 , 13 ),
559
- reason = "torch.compiler is not yet supported on Python >= 3.13 " ,
562
+ condition = tuple ( map ( int , torch . __version__ . split ( '.' )[: 2 ])) < ( 2 , 5 ),
563
+ reason = "PyTorch's associative_scan only exists for torch >= 2.5 " ,
560
564
strict = True ,
561
565
),
562
566
),
@@ -566,6 +570,8 @@ def test_lru_block_isolated(
566
570
@pytest .mark .parametrize (
567
571
"aggregate_fcn" , ["last_step" , "mean" ], ids = ["last-step" , "mean" ]
568
572
)
573
+ @pytest .mark .slow
574
+ @pytest .mark .filterwarnings ("ignore:Torchinductor" )
569
575
def test_lru_embedding_net_isolated (
570
576
bidirectional : bool ,
571
577
mode : str ,
@@ -677,10 +683,11 @@ def _simulator(thetas: Tensor, num_time_steps=500, dt=0.002, eps=0.05) -> Tensor
677
683
678
684
679
685
@pytest .mark .xfail (
680
- condition = sys . version_info >= ( 3 , 13 ),
681
- reason = "torch.compiler is not yet supported on Python >= 3.13 " ,
686
+ condition = tuple ( map ( int , torch . __version__ . split ( '.' )[: 2 ])) < ( 2 , 5 ),
687
+ reason = "PyTorch's associative_scan only exists for torch >= 2.5 " ,
682
688
strict = True ,
683
689
)
690
+ @pytest .mark .filterwarnings ("ignore:Torchinductor" )
684
691
def test_scan (
685
692
input_dim : int = 3 ,
686
693
output_dim : int = 3 ,
0 commit comments