reset sparse weights

This commit is contained in:
Hieu Hoang 2014-02-23 20:46:16 +00:00
parent 1716514eda
commit 7509e8bbaa

View File

@ -1212,7 +1212,18 @@ void StaticData::ResetWeights(const std::string &denseWeights, const std::string
}
// sparse weights
InputFileStream sparseStrme(sparseFile);
string line;
while (getline(sparseStrme, line)) {
vector<string> toks = Tokenize(line);
UTIL_THROW_IF2(toks.size() != 2, "Incorrect sparse weight format. Should be FFName_spareseName weight");
vector<string> names = Tokenize(toks[0], "_");
UTIL_THROW_IF2(names.size() != 2, "Incorrect sparse weight name. Should be FFName_spareseName");
const FeatureFunction &ff = FeatureFunction::FindFeatureFunction(names[0]);
m_allWeights.Assign(&ff, names[1], Scan<float>(toks[1]));
}
}
} // namespace