| 106 | } |
| 107 | |
| 108 | void PrintAllPythonOps(const std::vector<string>& op_list, |
| 109 | const std::vector<string>& api_def_dirs, |
| 110 | const string& source_file_name, bool require_shapes, |
| 111 | bool op_list_is_whitelist) { |
| 112 | OpList ops; |
| 113 | OpRegistry::Global()->Export(false, &ops); |
| 114 | |
| 115 | ApiDefMap api_def_map(ops); |
| 116 | if (!api_def_dirs.empty()) { |
| 117 | Env* env = Env::Default(); |
| 118 | |
| 119 | for (const auto& api_def_dir : api_def_dirs) { |
| 120 | std::vector<string> api_files; |
| 121 | TF_CHECK_OK(env->GetMatchingPaths(io::JoinPath(api_def_dir, "*.pbtxt"), |
| 122 | &api_files)); |
| 123 | TF_CHECK_OK(api_def_map.LoadFileList(env, api_files)); |
| 124 | } |
| 125 | api_def_map.UpdateDocs(); |
| 126 | } |
| 127 | |
| 128 | if (op_list_is_whitelist) { |
| 129 | std::unordered_set<string> whitelist(op_list.begin(), op_list.end()); |
| 130 | OpList pruned_ops; |
| 131 | for (const auto& op_def : ops.op()) { |
| 132 | if (whitelist.find(op_def.name()) != whitelist.end()) { |
| 133 | *pruned_ops.mutable_op()->Add() = op_def; |
| 134 | } |
| 135 | } |
| 136 | PrintPythonOps(pruned_ops, api_def_map, {}, require_shapes, |
| 137 | source_file_name); |
| 138 | } else { |
| 139 | PrintPythonOps(ops, api_def_map, op_list, require_shapes, source_file_name); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | } // namespace |
| 144 | } // namespace tensorflow |
no test coverage detected