Insert new (unnamed) broadcasting labels at the location of ellipsis.
| 176 | |
| 177 | // Insert new (unnamed) broadcasting labels at the location of ellipsis. |
| 178 | void InsertBroadcastLabels(int num_bcast_dims, int num_named_labels, |
| 179 | int ellipsis_axis, Labels* labels, |
| 180 | LabelCounts* label_counts) { |
| 181 | labels->erase(labels->begin() + ellipsis_axis); |
| 182 | labels->insert(labels->begin() + ellipsis_axis, num_bcast_dims, 0); |
| 183 | std::iota(labels->begin() + ellipsis_axis, |
| 184 | labels->begin() + ellipsis_axis + num_bcast_dims, num_named_labels); |
| 185 | // Increment label counts. Since these are new labels, the count is set to 1. |
| 186 | label_counts->resize(num_named_labels + num_bcast_dims, 1); |
| 187 | } |
| 188 | |
| 189 | // Record and validate the label to dimension mapping. Must be a named |
| 190 | // (non-broadcasting) label as broadcasting labels don't have a fixed dimension. |
no test coverage detected