提交 62eaa1fb 编写于 作者: P Peng Li

Move one line with identical value across loops out of the loop.

上级 749456bd
......@@ -91,8 +91,8 @@ void CRFLayer::backward(const UpdateCallback& callback) {
const int* starts = label.sequenceStartPositions->getData(false);
int numSequences = label.sequenceStartPositions->getSize() - 1;
bool needWGrad = weight_->getWGrad() ? true : false;
for (int i = 0; i < numSequences; ++i) {
bool needWGrad = weight_->getWGrad() ? true : false;
crfs_[i].backward(output.value->getData() + numClasses_ * starts[i],
label.ids->getData() + starts[i],
starts[i + 1] - starts[i], needWGrad);
......
......@@ -108,7 +108,7 @@ TEST(CRFLayer, cost) {
}
inline real epsilon() {
return typeid(real) == typeid(double) ? 1e-10 : 0.05;
return typeid(real) == typeid(double) ? 1e-10 : 0.06;
}
TestConfig initTestConfig(size_t numClasses, bool withWeight) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册