[llvm] [IR2Vec] Exposing Embedding as an ADT wrapped around std::vector<double> (PR #143197)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 6 19:10:30 PDT 2025


================
@@ -55,6 +55,40 @@ static cl::opt<float> ArgWeight("ir2vec-arg-weight", cl::Optional,
 
 AnalysisKey IR2VecVocabAnalysis::Key;
 
+// ==----------------------------------------------------------------------===//
+// Embedding
+//===----------------------------------------------------------------------===//
+
+Embedding &Embedding::operator+=(const Embedding &RHS) {
+  assert(this->size() == RHS.size() && "Vectors must have the same dimension");
+  std::transform(this->begin(), this->end(), RHS.begin(), this->begin(),
----------------
mtrofin wrote:

was going to suggest `llvm::transform` but looks like there's no overload for this

https://github.com/llvm/llvm-project/pull/143197


More information about the llvm-commits mailing list