MCPcopy Create free account
hub / github.com/catboost/catboost / InitFromMemory

Method InitFromMemory

library/cpp/text_processing/dictionary/bpe_dictionary.cpp:403–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

401}
402
403void TMMapBpeDictionary::InitFromMemory(const void* data, size_t size) {
404 const ui8* ptr = reinterpret_cast<const ui8*>(data);
405 Y_ENSURE(!std::memcmp(ptr, BPE_MAGIC, BPE_MAGIC_SIZE));
406 ptr += 16;
407
408 BpeSize = *reinterpret_cast<const ui64*>(ptr);
409 ptr += 16;
410
411 ui64 sourceTokenIdsToTokenIdSize = *reinterpret_cast<const ui64*>(ptr);
412 ptr += 8;
413 SourceTokenIdsToTokenIdSeed = *reinterpret_cast<const ui64*>(ptr);
414 ptr += 8;
415
416 const TBucket* bucketDataBegin = reinterpret_cast<const TBucket*>(ptr);
417 const TBucket* bucketDataEnd = reinterpret_cast<const TBucket*>(ptr + sourceTokenIdsToTokenIdSize);
418 SourceTokenIdsToTokenId = MakeArrayRef(bucketDataBegin, bucketDataEnd);
419 Y_ENSURE(size == 16 + 16 + 16 + sourceTokenIdsToTokenIdSize);
420}

Callers

nothing calls this directly

Calls 2

memcmpFunction · 0.85
MakeArrayRefFunction · 0.85

Tested by

no test coverage detected