mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-05 02:22:21 +03:00
use system pool for hypo
This commit is contained in:
parent
749c531996
commit
197fd1b903
@ -46,7 +46,7 @@ void QueueItem::CreateHypothesis(Manager &mgr)
|
||||
//cerr << prevHypo << endl;
|
||||
//cerr << *prevHypo << endl;
|
||||
|
||||
hypo = Hypothesis::Create(mgr.system.GetSystemPool(), mgr);
|
||||
hypo = Hypothesis::Create(mgr.GetSystemPool(), mgr);
|
||||
hypo->Init(mgr, *prevHypo, edge->path, tp, edge->newBitmap, edge->estimatedScore);
|
||||
hypo->EvaluateWhenApplied();
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ void Search::Decode()
|
||||
}
|
||||
|
||||
const Bitmap &initBitmap = m_mgr.GetBitmaps().GetInitialBitmap();
|
||||
Hypothesis *initHypo = Hypothesis::Create(m_mgr.system.GetSystemPool(), m_mgr);
|
||||
Hypothesis *initHypo = Hypothesis::Create(m_mgr.GetSystemPool(), m_mgr);
|
||||
initHypo->Init(m_mgr, m_mgr.GetInputPaths().GetBlank(), m_mgr.GetInitPhrase(), initBitmap);
|
||||
initHypo->EmptyHypothesisState(m_mgr.GetInput());
|
||||
|
||||
|
@ -45,6 +45,7 @@ void Manager::Init()
|
||||
{
|
||||
// init pools etc
|
||||
m_pool = &system.GetManagerPool();
|
||||
m_systemPool = &system.GetSystemPool();
|
||||
m_hypoRecycle = &system.GetHypoRecycler();
|
||||
|
||||
m_initPhrase = new (GetPool().Allocate<TargetPhrase>()) TargetPhrase(GetPool(), system, 0);
|
||||
|
@ -42,6 +42,9 @@ public:
|
||||
MemPool &GetPool() const
|
||||
{ return *m_pool; }
|
||||
|
||||
MemPool &GetSystemPool() const
|
||||
{ return *m_systemPool; }
|
||||
|
||||
Recycler<Hypothesis*> &GetHypoRecycle() const
|
||||
{ return *m_hypoRecycle; }
|
||||
|
||||
@ -65,7 +68,7 @@ public:
|
||||
void OutputBest() const;
|
||||
|
||||
protected:
|
||||
mutable MemPool *m_pool;
|
||||
mutable MemPool *m_pool, *m_systemPool;
|
||||
mutable Recycler<Hypothesis*> *m_hypoRecycle;
|
||||
|
||||
std::string m_inputStr;
|
||||
|
@ -38,7 +38,7 @@ void SearchNormal::Decode()
|
||||
m_stacks.Init(m_mgr.GetInput().GetSize() + 1);
|
||||
|
||||
const Bitmap &initBitmap = m_mgr.GetBitmaps().GetInitialBitmap();
|
||||
Hypothesis *initHypo = Hypothesis::Create(m_mgr.system.GetSystemPool(), m_mgr);
|
||||
Hypothesis *initHypo = Hypothesis::Create(m_mgr.GetSystemPool(), m_mgr);
|
||||
initHypo->Init(m_mgr, m_mgr.GetInputPaths().GetBlank(), m_mgr.GetInitPhrase(), initBitmap);
|
||||
initHypo->EmptyHypothesisState(m_mgr.GetInput());
|
||||
|
||||
@ -117,7 +117,7 @@ void SearchNormal::Extend(const Hypothesis &hypo,
|
||||
const Bitmap &newBitmap,
|
||||
SCORE estimatedScore)
|
||||
{
|
||||
Hypothesis *newHypo = Hypothesis::Create(m_mgr.system.GetSystemPool(), m_mgr);
|
||||
Hypothesis *newHypo = Hypothesis::Create(m_mgr.GetSystemPool(), m_mgr);
|
||||
newHypo->Init(m_mgr, hypo, path, tp, newBitmap, estimatedScore);
|
||||
newHypo->EvaluateWhenApplied();
|
||||
|
||||
|
@ -42,7 +42,7 @@ void SearchNormalBatch::Decode()
|
||||
m_stacks.Init(m_mgr.GetInput().GetSize() + 1);
|
||||
|
||||
const Bitmap &initBitmap = m_mgr.GetBitmaps().GetInitialBitmap();
|
||||
Hypothesis *initHypo = Hypothesis::Create(m_mgr.system.GetSystemPool(), m_mgr);
|
||||
Hypothesis *initHypo = Hypothesis::Create(m_mgr.GetSystemPool(), m_mgr);
|
||||
initHypo->Init(m_mgr, m_mgr.GetInputPaths().GetBlank(), m_mgr.GetInitPhrase(), initBitmap);
|
||||
initHypo->EmptyHypothesisState(m_mgr.GetInput());
|
||||
|
||||
@ -150,7 +150,7 @@ void SearchNormalBatch::Extend(const Hypothesis &hypo,
|
||||
const Bitmap &newBitmap,
|
||||
SCORE estimatedScore)
|
||||
{
|
||||
Hypothesis *newHypo = Hypothesis::Create(m_mgr.system.GetSystemPool(), m_mgr);
|
||||
Hypothesis *newHypo = Hypothesis::Create(m_mgr.GetSystemPool(), m_mgr);
|
||||
newHypo->Init(m_mgr, hypo, path, tp, newBitmap, estimatedScore);
|
||||
newHypo->EvaluateWhenAppliedNonBatch();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user