Skip to content

Commit

Permalink
avoid KeyError (review mdouze)
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Jan 29, 2021
1 parent f2df3a4 commit 95d60df
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion faiss/python/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ def instruction_set():
logger = logging.getLogger(__name__)

try:
has_AVX2 = instruction_set()["AVX2"] # dict-values of instruction_set() are True or False
instr_set = instruction_set()
# dict-values of instr_set are True or False, but do not have
# uniform keys across arches -> use fallback value of False
has_AVX2 = instr_set.get("AVX2", False)
if has_AVX2:
logger.info("Loading faiss with AVX2 support.")
from .swigfaiss_avx2 import *
Expand Down

0 comments on commit 95d60df

Please sign in to comment.