| 162 | } |
| 163 | |
| 164 | Status GrapplerItem::AddDevices(const GrapplerItem& other) { |
| 165 | std::vector<absl::string_view> invalid_devices; |
| 166 | for (const string& device : other.devices()) { |
| 167 | Status added = AddDevice(device); |
| 168 | if (!added.ok()) invalid_devices.emplace_back(device); |
| 169 | } |
| 170 | return invalid_devices.empty() |
| 171 | ? Status::OK() |
| 172 | : errors::InvalidArgument("Skipped invalid devices: [", |
| 173 | absl::StrJoin(invalid_devices, ", "), |
| 174 | "]"); |
| 175 | } |
| 176 | |
| 177 | Status GrapplerItem::InferDevicesFromGraph() { |
| 178 | absl::flat_hash_set<absl::string_view> invalid_devices; |