File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change 11import torch
22from typing import Optional
33from pathlib import Path
4+ import warnings
45
56so_files = list (Path (__file__ ).parent .glob ("_C*.so" ))
67# assert len(so_files) == 1, f"Expected one _C*.so file, found {len(so_files)}"
1011elif len (so_files ) > 1 :
1112 raise ValueError (f"Expected one _C*.so file, found { len (so_files )} " )
1213else :
14+ warnings .warn ("No _C*.so file found. Custom extension not loaded." )
1315 EXTENSION_LOADED = False
1416
1517from .core import LPC
Original file line number Diff line number Diff line change 66
77from .parallel_scan import compute_linear_recurrence , WARPSIZE
88from .core import lpc_cuda , lpc_np
9+ from . import EXTENSION_LOADED
910
1011
1112class Recurrence (Function ):
@@ -32,7 +33,7 @@ def forward(
3233 else :
3334 num_threads = torch .get_num_threads ()
3435 # This is just a rough estimation of the computational cost
35- if min (n_dims , num_threads ) < num_threads / 3 :
36+ if EXTENSION_LOADED and min (n_dims , num_threads ) < num_threads / 3 :
3637 out = torch .ops .torchlpc .scan_cpu (impulse , decay , initial_state )
3738 else :
3839 out = torch .from_numpy (
You can’t perform that action at this time.
0 commit comments