Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Native/LdaNative/lda_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ namespace lda {
CTimer tmDebug(true);
CheckFunction(0, tmDebug, "enter initializeBeforeTrain", false);
//allocate model memory from the data preloaded
AllocateModelMemory(data_block_);
AllocateModelMemory(*data_block_);
CheckFunction(0, tmDebug, "allocate model memory", false);

double alloc_start = lda::get_time();
Expand Down Expand Up @@ -676,7 +676,7 @@ namespace lda {
data_block_->Allocate(num_document, corpus_size);
}

void LdaEngine::AllocateModelMemory(const LDADataBlock* data_block)
void LdaEngine::AllocateModelMemory(const LDADataBlock& data_block)
{
model_block_->InitFromDataBlock(data_block, V_, K_);

Expand Down
2 changes: 1 addition & 1 deletion src/Native/LdaNative/lda_engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace lda {
void InitializeBeforeTest();
bool InitializeBeforeTrain();
void AllocateDataMemory(int num_document, int64_t corpus_size);
void AllocateModelMemory(const LDADataBlock* data_block); //in this case, model memory is allocated according to the datablock;
void AllocateModelMemory(const LDADataBlock& data_block); //in this case, model memory is allocated according to the datablock;
void AllocateModelMemory(int num_vocabs, int num_topics, int64_t nonzero_num);
void AllocateModelMemory(int num_vocabs, int num_topics, int64_t mem_block_size, int64_t alias_mem_block_size);
void SetAlphaSum(float avgDocLength); //alphasum parameter is set by avgdoclength * alpha
Expand Down
6 changes: 3 additions & 3 deletions src/Native/LdaNative/model_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,12 @@ namespace lda
cout << "alias_mem_block_size = " << sizeof(alias_mem_block_size_) << endl;
}

void LDAModelBlock::InitFromDataBlock(const LDADataBlock *data_block, int32_t num_vocabs, int32_t num_topics)
void LDAModelBlock::InitFromDataBlock(const LDADataBlock &data_block, int32_t num_vocabs, int32_t num_topics)
{
num_vocabs_ = num_vocabs;
num_topics_ = num_topics;

int32_t doc_num = data_block->num_documents();
int32_t doc_num = data_block.num_documents();
dict_ = new WordEntry[num_vocabs_];
for (int i = 0; i < num_vocabs_; ++i)
{
Expand All @@ -367,7 +367,7 @@ namespace lda

for (int i = 0; i < doc_num; ++i)
{
shared_ptr<LDADocument> doc = data_block->GetOneDoc(i);
shared_ptr<LDADocument> doc = data_block.GetOneDoc(i);
int32_t doc_size = doc->size();
for (int j = 0; j < doc_size; ++j)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Native/LdaNative/model_block.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace lda
void Init(int32_t num_vocabs, int32_t num_topics, int64_t nonzero_num);
void Init(int32_t num_vocabs, int32_t num_topics, int64_t mem_block_size, int64_t alias_mem_block_size);

void InitFromDataBlock(const LDADataBlock *data_block, int32_t num_vocabs, int32_t num_topics);
void InitFromDataBlock(const LDADataBlock &data_block, int32_t num_vocabs, int32_t num_topics);

void GetModelStat(int64_t &mem_block_size, int64_t &alias_mem_block_size);

Expand Down