| 68 | } |
| 69 | |
| 70 | AttrToInputsMap* GetAttrToInputsMap(const tensorflow::OpDef& op_def) { |
| 71 | tensorflow::mutex_lock l(all_attr_to_input_maps_lock); |
| 72 | auto* all_attr_to_input_maps = GetAllAttrToInputsMaps(); |
| 73 | |
| 74 | auto* output = |
| 75 | tensorflow::gtl::FindPtrOrNull(*all_attr_to_input_maps, op_def.name()); |
| 76 | if (output != nullptr) { |
| 77 | return output; |
| 78 | } |
| 79 | |
| 80 | std::unique_ptr<AttrToInputsMap> m(new AttrToInputsMap); |
| 81 | |
| 82 | // Store a list of InputIndex -> List of corresponding inputs. |
| 83 | for (int i = 0; i < op_def.input_arg_size(); i++) { |
| 84 | if (!op_def.input_arg(i).type_attr().empty()) { |
| 85 | auto it = m->find(op_def.input_arg(i).type_attr()); |
| 86 | if (it == m->end()) { |
| 87 | it = m->insert({op_def.input_arg(i).type_attr(), {}}).first; |
| 88 | } |
| 89 | it->second.emplace_back(i, !op_def.input_arg(i).number_attr().empty()); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | auto* retval = m.get(); |
| 94 | (*all_attr_to_input_maps)[op_def.name()] = m.release(); |
| 95 | |
| 96 | return retval; |
| 97 | } |
| 98 | |
| 99 | struct FastPathOpExecInfo { |
| 100 | TFE_Context* ctx; |
no test coverage detected