| 337 | #undef VALIDATE |
| 338 | |
| 339 | Status CheckOpDeprecation(const OpDef& op_def, int graph_def_version) { |
| 340 | if (op_def.has_deprecation()) { |
| 341 | const OpDeprecation& dep = op_def.deprecation(); |
| 342 | if (graph_def_version >= dep.version()) { |
| 343 | return errors::Unimplemented( |
| 344 | "Op ", op_def.name(), " is not available in GraphDef version ", |
| 345 | graph_def_version, ". It has been removed in version ", dep.version(), |
| 346 | ". ", dep.explanation(), "."); |
| 347 | } else { |
| 348 | // Warn only once for each op name, and do it in a threadsafe manner. |
| 349 | static mutex mu(LINKER_INITIALIZED); |
| 350 | static std::unordered_set<string> warned; |
| 351 | bool warn; |
| 352 | { |
| 353 | mutex_lock lock(mu); |
| 354 | warn = warned.insert(op_def.name()).second; |
| 355 | } |
| 356 | if (warn) { |
| 357 | LOG(WARNING) << "Op " << op_def.name() << " is deprecated." |
| 358 | << " It will cease to work in GraphDef version " |
| 359 | << dep.version() << ". " << dep.explanation() << "."; |
| 360 | } |
| 361 | } |
| 362 | } |
| 363 | return Status::OK(); |
| 364 | } |
| 365 | |
| 366 | namespace { |
| 367 |
no test coverage detected