| 74 | } |
| 75 | |
| 76 | Status OpRegistry::LookUpSlow(const string& op_type_name, |
| 77 | const OpRegistrationData** op_reg_data) const { |
| 78 | *op_reg_data = nullptr; |
| 79 | const OpRegistrationData* res = nullptr; |
| 80 | |
| 81 | bool first_call = false; |
| 82 | bool first_unregistered = false; |
| 83 | { // Scope for lock. |
| 84 | mutex_lock lock(mu_); |
| 85 | first_call = MustCallDeferred(); |
| 86 | res = gtl::FindWithDefault(registry_, op_type_name, nullptr); |
| 87 | |
| 88 | static bool unregistered_before = false; |
| 89 | first_unregistered = !unregistered_before && (res == nullptr); |
| 90 | if (first_unregistered) { |
| 91 | unregistered_before = true; |
| 92 | } |
| 93 | // Note: Can't hold mu_ while calling Export() below. |
| 94 | } |
| 95 | if (first_call) { |
| 96 | TF_QCHECK_OK(ValidateKernelRegistrations(*this)); |
| 97 | } |
| 98 | if (res == nullptr) { |
| 99 | if (first_unregistered) { |
| 100 | OpList op_list; |
| 101 | Export(true, &op_list); |
| 102 | if (VLOG_IS_ON(3)) { |
| 103 | LOG(INFO) << "All registered Ops:"; |
| 104 | for (const auto& op : op_list.op()) { |
| 105 | LOG(INFO) << SummarizeOpDef(op); |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | Status status = errors::NotFound( |
| 110 | "Op type not registered '", op_type_name, "' in binary running on ", |
| 111 | port::Hostname(), ". ", |
| 112 | "Make sure the Op and Kernel are registered in the " |
| 113 | "binary running in this process. Note that if you " |
| 114 | "are loading a saved graph which used ops from " |
| 115 | "tf.contrib, accessing (e.g.) `tf.contrib.resampler` should be done " |
| 116 | "before importing the graph, as contrib ops are lazily registered " |
| 117 | "when the module is first accessed."); |
| 118 | VLOG(1) << status.ToString(); |
| 119 | return status; |
| 120 | } |
| 121 | *op_reg_data = res; |
| 122 | return Status::OK(); |
| 123 | } |
| 124 | |
| 125 | void OpRegistry::GetRegisteredOps(std::vector<OpDef>* op_defs) { |
| 126 | mutex_lock lock(mu_); |
nothing calls this directly
no test coverage detected