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

0.10.0rc
Peng Li 9 years ago
parent 749456bd60
commit 62eaa1fbab

@ -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) {

Loading…
Cancel
Save