| 305 | const char kXlaOutsideCompilationAttrName[] = "_xla_outside_compilation"; |
| 306 | |
| 307 | Status ValidateConfig(const tf2xla::Config& config) { |
| 308 | std::set<string> names; |
| 309 | for (const tf2xla::Feed& feed : config.feed()) { |
| 310 | TF_RETURN_IF_ERROR(ValidateTensorId(feed.id())); |
| 311 | TF_RETURN_IF_ERROR(TensorShape::IsValidShape(feed.shape())); |
| 312 | TF_RETURN_IF_ERROR(CheckNameDuplicates("feed", feed.name(), &names)); |
| 313 | } |
| 314 | TF_RETURN_IF_ERROR(CheckFeedFetchNameConflicts("feed", names)); |
| 315 | names.clear(); |
| 316 | for (const tf2xla::Fetch& fetch : config.fetch()) { |
| 317 | TF_RETURN_IF_ERROR(ValidateTensorId(fetch.id())); |
| 318 | TF_RETURN_IF_ERROR(CheckNameDuplicates("fetch", fetch.name(), &names)); |
| 319 | } |
| 320 | TF_RETURN_IF_ERROR(CheckFeedFetchNameConflicts("fetch", names)); |
| 321 | if (config.fetch().empty()) { |
| 322 | return errors::InvalidArgument("fetches must be specified"); |
| 323 | } |
| 324 | return Status::OK(); |
| 325 | } |
| 326 | |
| 327 | Status AddPlaceholdersForFeeds( |
| 328 | const tf2xla::Config& config, const OpRegistryInterface* op_registry, |