An adapter to allow an OpList to be used as an OpRegistryInterface. Note that shape inference functions are not passed in to OpListOpRegistry, so it will return an unusable shape inference function for every op it supports; therefore, it should only be used in contexts where this is okay.
| 165 | // it will return an unusable shape inference function for every op it supports; |
| 166 | // therefore, it should only be used in contexts where this is okay. |
| 167 | class OpListOpRegistry : public OpRegistryInterface { |
| 168 | public: |
| 169 | // Does not take ownership of op_list, *op_list must outlive *this. |
| 170 | explicit OpListOpRegistry(const OpList* op_list); |
| 171 | ~OpListOpRegistry() override; |
| 172 | Status LookUp(const string& op_type_name, |
| 173 | const OpRegistrationData** op_reg_data) const override; |
| 174 | |
| 175 | private: |
| 176 | // Values are owned. |
| 177 | std::unordered_map<string, const OpRegistrationData*> index_; |
| 178 | }; |
| 179 | |
| 180 | // Support for defining the OpDef (specifying the semantics of the Op and how |
| 181 | // it should be created) and registering it in the OpRegistry::Global() |