mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
Fix sharding bug
This commit is contained in:
parent
d742341176
commit
62d7d034bb
@ -21,8 +21,8 @@ Data::Data()
|
||||
: theScorer(NULL),
|
||||
number_of_scores(0),
|
||||
_sparse_flag(false),
|
||||
scoredata(NULL),
|
||||
featdata(NULL) {}
|
||||
scoredata(),
|
||||
featdata() {}
|
||||
|
||||
Data::Data(Scorer& ptr)
|
||||
: theScorer(&ptr),
|
||||
@ -36,17 +36,6 @@ Data::Data(Scorer& ptr)
|
||||
TRACE_ERR("Data::Scorer type from Scorer: " << theScorer->getName() << endl);
|
||||
}
|
||||
|
||||
Data::~Data() {
|
||||
if (featdata) {
|
||||
delete featdata;
|
||||
featdata = NULL;
|
||||
}
|
||||
if (scoredata) {
|
||||
delete scoredata;
|
||||
scoredata = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//ADDED BY TS
|
||||
void Data::remove_duplicates() {
|
||||
|
||||
@ -128,7 +117,6 @@ void Data::remove_duplicates() {
|
||||
// }
|
||||
}
|
||||
|
||||
std::cerr << "removed " << nRemoved << "/" << feat_array.size() << std::endl;
|
||||
|
||||
if (nRemoved > 0) {
|
||||
|
||||
|
18
mert/Data.h
18
mert/Data.h
@ -15,12 +15,17 @@ using namespace std;
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
#include<boost/shared_ptr.hpp>
|
||||
|
||||
#include "Util.h"
|
||||
#include "FeatureData.h"
|
||||
#include "ScoreData.h"
|
||||
|
||||
class Scorer;
|
||||
|
||||
typedef boost::shared_ptr<ScoreData> ScoreDataHandle;
|
||||
typedef boost::shared_ptr<FeatureData> FeatureDataHandle;
|
||||
|
||||
class Data
|
||||
{
|
||||
private:
|
||||
@ -30,25 +35,26 @@ private:
|
||||
bool _sparse_flag;
|
||||
|
||||
protected:
|
||||
// TODO: Use smart pointers for exceptional-safety.
|
||||
ScoreData* scoredata;
|
||||
FeatureData* featdata;
|
||||
ScoreDataHandle scoredata;
|
||||
FeatureDataHandle featdata;
|
||||
|
||||
public:
|
||||
explicit Data(Scorer& sc);
|
||||
Data();
|
||||
~Data();
|
||||
|
||||
//Note that there is no copy constructor implemented, so only the
|
||||
//compiler synthesised shallow copy is available
|
||||
|
||||
inline void clear() {
|
||||
scoredata->clear();
|
||||
featdata->clear();
|
||||
}
|
||||
|
||||
ScoreData* getScoreData() {
|
||||
ScoreDataHandle getScoreData() {
|
||||
return scoredata;
|
||||
}
|
||||
|
||||
FeatureData* getFeatureData() {
|
||||
FeatureDataHandle getFeatureData() {
|
||||
return featdata;
|
||||
}
|
||||
|
||||
|
@ -38,13 +38,13 @@ void Optimizer::SetScorer(Scorer *_scorer)
|
||||
scorer = _scorer;
|
||||
}
|
||||
|
||||
void Optimizer::SetFData(FeatureData *_FData)
|
||||
void Optimizer::SetFData(FeatureDataHandle _FData)
|
||||
{
|
||||
FData = _FData;
|
||||
}
|
||||
|
||||
Optimizer::Optimizer(unsigned Pd, vector<unsigned> i2O, vector<parameter_t> start, unsigned int nrandom)
|
||||
: scorer(NULL), FData(NULL), number_of_random_directions(nrandom)
|
||||
: scorer(NULL), FData(), number_of_random_directions(nrandom)
|
||||
{
|
||||
// Warning: the init vector is a full set of parameters, of dimension pdim!
|
||||
Point::pdim = Pd;
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "Data.h"
|
||||
#include "FeatureData.h"
|
||||
#include "Scorer.h"
|
||||
#include "Types.h"
|
||||
@ -20,13 +21,13 @@ class Optimizer
|
||||
{
|
||||
protected:
|
||||
Scorer *scorer; // no accessor for them only child can use them
|
||||
FeatureData *FData; // no accessor for them only child can use them
|
||||
FeatureDataHandle FData; // no accessor for them only child can use them
|
||||
unsigned int number_of_random_directions;
|
||||
|
||||
public:
|
||||
Optimizer(unsigned Pd, vector<unsigned> i2O, vector<parameter_t> start, unsigned int nrandom);
|
||||
void SetScorer(Scorer *_scorer);
|
||||
void SetFData(FeatureData *_FData);
|
||||
void SetFData(FeatureDataHandle _FData);
|
||||
virtual ~Optimizer();
|
||||
|
||||
unsigned size() const {
|
||||
|
Loading…
Reference in New Issue
Block a user