Skip to content

Python IndexBinaryFlat.reconstruct_n() broken #2751

@Dobatymo

Description

@Dobatymo

Summary

reconstruct_n on a IndexBinaryFlat throws a TypeError about a additional argument for the reconstructed vectors. Other Indexes simply return them. Also providing a None value simply crashes Python.

>>> import faiss
>>> index = faiss.IndexBinaryFlat(64)
>>> index.reconstruct_n(0, 4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: reconstruct_n() missing 1 required positional argument: 'recons'
>>> index.reconstruct_n(0, 4, None)  # crash!

EDIT: It looks like the reconstruct_n definition is missing for handle_IndexBinary (?)

def handle_IndexBinary(the_class):

Platform

OS: Windows 10
Python version: 3.8.10
Faiss version: faiss-cpu==1.7.3
Installed from: pip

Running on:

  • CPU
  • GPU

Interface:

  • C++
  • Python

Reproduction instructions

See summary.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions