Skip to content

Commit 3a26ca4

Browse files
committed
Fix the grid tag logic
1 parent 9fedb6c commit 3a26ca4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Diff for: src/models/model.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,18 @@ void model::setup_layer_grid_tags(const std::vector<El::Grid*>& fngrids)
10161016
// the same, set to parent value. If any is different, set to 0.
10171017
// (Note that if we're doing "layer parallelism", they should all be
10181018
// -1 and this definition will recover that.)
1019-
for (auto& layer : this->get_layers()) {
1019+
bool doing_subgraph_stuff = false;
1020+
auto const layers = this->get_layers();
1021+
for (auto& layer : layers) {
1022+
if (layer->get_grid_tag() >= 0) {
1023+
doing_subgraph_stuff = true;
1024+
break;
1025+
}
1026+
}
1027+
if (!doing_subgraph_stuff)
1028+
return;
1029+
1030+
for (auto& layer : layers) {
10201031
int tag = layer->get_grid_tag();
10211032
if (tag < 0) {
10221033
tag = 0; // now it's at least valid if there are no parents

0 commit comments

Comments
 (0)