LLVM 22.0.0git
|
Generic storage class for section-based vocabularies. More...
#include "llvm/Analysis/IR2Vec.h"
Classes | |
class | const_iterator |
Iterator support for section-based access. More... |
Public Types | |
using | VocabMap = std::map<std::string, Embedding> |
Public Member Functions | |
VocabStorage () | |
Default constructor creates empty storage (invalid state) | |
VocabStorage (std::vector< std::vector< Embedding > > &&SectionData) | |
Create a VocabStorage with pre-organized section data. | |
VocabStorage (VocabStorage &&)=default | |
VocabStorage & | operator= (VocabStorage &&)=delete |
VocabStorage (const VocabStorage &)=delete | |
VocabStorage & | operator= (const VocabStorage &)=delete |
size_t | size () const |
Get total number of entries across all sections. | |
unsigned | getNumSections () const |
Get number of sections. | |
const std::vector< Embedding > & | operator[] (unsigned SectionId) const |
Section-based access: Storage[sectionId][localIndex]. | |
unsigned | getDimension () const |
Get vocabulary dimension. | |
bool | isValid () const |
Check if vocabulary is valid (has data) | |
const_iterator | begin () const |
const_iterator | end () const |
Static Public Member Functions | |
static Error | parseVocabSection (StringRef Key, const json::Value &ParsedVocabValue, VocabMap &TargetVocab, unsigned &Dim) |
Parse a vocabulary section from JSON and populate the target vocabulary map. |
Generic storage class for section-based vocabularies.
VocabStorage provides a generic foundation for storing and accessing embeddings organized into sections.
using llvm::ir2vec::VocabStorage::VocabMap = std::map<std::string, Embedding> |
|
inline |
Default constructor creates empty storage (invalid state)
Definition at line 161 of file IR2Vec.h.
Referenced by llvm::ir2vec::VocabStorage::const_iterator::const_iterator(), llvm::ir2vec::Vocabulary::createDummyVocabForTest(), operator=(), operator=(), VocabStorage(), and VocabStorage().
VocabStorage::VocabStorage | ( | std::vector< std::vector< Embedding > > && | SectionData | ) |
Create a VocabStorage with pre-organized section data.
Definition at line 269 of file IR2Vec.cpp.
References assert(), llvm::move(), and Size.
|
default |
References VocabStorage().
|
delete |
References VocabStorage().
|
inline |
|
inline |
Definition at line 210 of file IR2Vec.h.
References getNumSections().
|
inline |
|
inline |
Get number of sections.
Definition at line 176 of file IR2Vec.h.
Referenced by end(), and llvm::ir2vec::VocabStorage::const_iterator::operator++().
|
inline |
|
delete |
References VocabStorage().
|
delete |
References VocabStorage().
|
static |
Parse a vocabulary section from JSON and populate the target vocabulary map.
Definition at line 333 of file IR2Vec.cpp.
References llvm::createStringError(), llvm::json::fromJSON(), llvm::json::Object::get(), llvm::json::Value::getAsObject(), llvm::illegal_byte_sequence, llvm::InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key, llvm::invalid_argument, and llvm::Error::success().
|
inline |
Get total number of entries across all sections.
Definition at line 173 of file IR2Vec.h.
Referenced by llvm::ir2vec::VocabStorage::const_iterator::operator*().