Skip to content

Commit a371dca

Browse files
authored
Remember if network has format before making mutable. (LeelaChessZero#1149)
1 parent 0cc9b4b commit a371dca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/neural/loader.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ std::string DecompressGzip(const std::string& filename) {
107107
void FixOlderWeightsFile(WeightsFile* file) {
108108
using nf = pblczero::NetworkFormat;
109109
auto network_format = file->format().network_format().network();
110-
if (file->format().has_network_format() &&
111-
network_format != nf::NETWORK_CLASSICAL &&
110+
const auto has_network_format = file->format().has_network_format();
111+
if (has_network_format && network_format != nf::NETWORK_CLASSICAL &&
112112
network_format != nf::NETWORK_SE) {
113113
// Already in a new format, return unchanged.
114114
return;
115115
}
116116

117117
auto* net = file->mutable_format()->mutable_network_format();
118-
if (!file->format().has_network_format()) {
118+
if (!has_network_format) {
119119
// Older protobufs don't have format definition.
120120
net->set_input(nf::INPUT_CLASSICAL_112_PLANE);
121121
net->set_output(nf::OUTPUT_CLASSICAL);

0 commit comments

Comments
 (0)