mirror of
https://github.com/facebookresearch/faiss.git
synced 2026-10-12 02:13:36 +00:00
Fix miscellaneous lint warnings (#5093)
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/5093 Fix remaining miscellaneous lint warnings across 10 files: - `facebook-hte-MultTypeDeclaration`: Split mixed-type declaration in AutoTune.cpp - `facebook-hte-IdenticalOperands`: Rename variable in build.cpp to avoid false positive - `facebook-hte-BadImplicitCast`: Add explicit cast in Index.cpp - `performance-inefficient-vector-operation`: Add reserve() in IndexBinaryIVF.cpp - `performance-for-range-copy`: Use const reference in IndexBinaryHash.cpp range-for - `facebook-hte-UnassignedReleasedUniquePointer`: Capture release() results in IVFlib.cpp, IndexPreTransform.cpp - `facebook-hte-UnqualifiedCall-sqrt`: Use std::sqrt() in MatrixStats.cpp - `facebook-unused-include-check`: Remove unused includes in IndexIVF.cpp, IndexNNDescent.cpp, IndexNSG.cpp - `clang-diagnostic-switch-enum`: Add missing enum cases in IndexAdditiveQuantizer.cpp, IndexIVFAdditiveQuantizer.cpp Reviewed By: pankajsingh88 Differential Revision: D100592786 fbshipit-source-id: 1d324e30d79e967c345737bae6991e9a443622ee
This commit is contained in:
committed by
meta-codesync[bot]
parent
ed11f283d6
commit
b0568942ef
+2
-1
@@ -279,7 +279,8 @@ size_t ParameterSpace::n_combinations() const {
|
||||
|
||||
/// get string representation of the combination
|
||||
std::string ParameterSpace::combination_name(size_t cno) const {
|
||||
char buf[1000], *wp = buf;
|
||||
char buf[1000];
|
||||
char* wp = buf;
|
||||
*wp = 0;
|
||||
for (size_t i = 0; i < parameter_ranges.size(); i++) {
|
||||
FAISS_THROW_IF_NOT_MSG(
|
||||
|
||||
+2
-1
@@ -492,7 +492,8 @@ IndexIVFResidualQuantizer* ivf_residual_from_quantizer(
|
||||
faiss::METRIC_L2,
|
||||
rq.search_type));
|
||||
index->own_fields = true;
|
||||
rcq.release();
|
||||
// Ownership transferred to index via own_fields = true
|
||||
(void)rcq.release();
|
||||
index->by_residual = true;
|
||||
index->rq.initialize_from(rq, nlevel);
|
||||
index->is_trained = true;
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ void Index::add_with_ids(
|
||||
|
||||
size_t Index::remove_ids(const IDSelector& /*sel*/) {
|
||||
FAISS_THROW_MSG("remove_ids not implemented for this type of index");
|
||||
return -1;
|
||||
return static_cast<size_t>(-1);
|
||||
}
|
||||
|
||||
void Index::reconstruct(idx_t, float*) const {
|
||||
|
||||
@@ -526,6 +526,7 @@ void search_knn_hamming_count(
|
||||
idx_t max_codes = params ? params->max_codes : ivf->max_codes;
|
||||
|
||||
std::vector<HCounterState<HammingComputer>> cs;
|
||||
cs.reserve(nx);
|
||||
for (size_t i = 0; i < nx; ++i) {
|
||||
cs.push_back(
|
||||
HCounterState<HammingComputer>(
|
||||
|
||||
@@ -312,6 +312,7 @@ InvertedListScanner* IndexIVFAdditiveQuantizer::get_InvertedListScanner(
|
||||
case AdditiveQuantizer::ST_norm_rq2x4:
|
||||
A(ST_norm_cqint8)
|
||||
#undef A
|
||||
case AdditiveQuantizer::ST_count:
|
||||
default:
|
||||
FAISS_THROW_FMT(
|
||||
"search type %d not supported", aq->search_type);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <faiss/impl/AuxIndexStructures.h>
|
||||
#include <faiss/impl/FaissAssert.h>
|
||||
#include <faiss/impl/VisitedTable.h>
|
||||
#include <faiss/utils/distances.h>
|
||||
|
||||
namespace faiss {
|
||||
|
||||
|
||||
@@ -129,7 +129,9 @@ const float* IndexPreTransform::apply_chain(idx_t n, const float* x) const {
|
||||
del2.swap(del);
|
||||
prev_x = xt;
|
||||
}
|
||||
del.release();
|
||||
// Intentionally release ownership: caller takes ownership of the returned
|
||||
// buffer
|
||||
(void)del.release();
|
||||
return prev_x;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ void MatrixStats::PerDimStats::compute_mean_std() {
|
||||
if (var < 0) {
|
||||
var = 0;
|
||||
}
|
||||
stddev = sqrt(var);
|
||||
stddev = std::sqrt(var);
|
||||
}
|
||||
|
||||
void MatrixStats::do_comment(const char* fmt, ...) {
|
||||
@@ -163,8 +163,8 @@ MatrixStats::MatrixStats(size_t n_in, size_t d_in, const float* x)
|
||||
}
|
||||
|
||||
{ // norm stats
|
||||
min_norm2 = sqrt(min_norm2);
|
||||
max_norm2 = sqrt(max_norm2);
|
||||
min_norm2 = std::sqrt(min_norm2);
|
||||
max_norm2 = std::sqrt(max_norm2);
|
||||
do_comment(
|
||||
"range of L2 norms=[%g, %g] (%zd null vectors)\n",
|
||||
min_norm2,
|
||||
|
||||
+4
-4
@@ -10,14 +10,14 @@
|
||||
namespace faiss {
|
||||
|
||||
bool has_omp() {
|
||||
int omp = 1;
|
||||
int omp_available = 1;
|
||||
// Detect whether OpenMP is enabled by using the 'max' reduction to render
|
||||
// the below assignment a no-op. This works:
|
||||
// 1) without starting any threads
|
||||
// 2) irrespective of the current thread limit
|
||||
#pragma omp parallel reduction(max : omp) num_threads(1)
|
||||
omp = 0;
|
||||
return omp != 0;
|
||||
#pragma omp parallel reduction(max : omp_available) num_threads(1)
|
||||
omp_available = 0;
|
||||
return omp_available != 0;
|
||||
}
|
||||
|
||||
} // namespace faiss
|
||||
|
||||
Reference in New Issue
Block a user