def add_custom_replacement_description_from_config(self, file_name: str): if not os.path.exists(file_name): raise Error("Custom replacement configuration file '{}' doesn't exist. ".format(file_name) + refer_to_faq_msg(46)) descriptions = parse_custom_replacement_config_file(file_name) for desc in descriptions: self.registry.setdefault(desc.id, list()).append(desc) log.info("Registered custom replacement with id '{}'".format(desc.id))
def find_and_replace_pattern(self, graph: Graph): argv = graph.graph['cmd_params'] file_name = argv.tensorflow_custom_operations_config_update data = parse_custom_replacement_config_file(file_name) if data is None: raise Error("Cannot update the file '{}' because it is broken. ".format(file_name) + refer_to_faq_msg(73)) for replacement_desc in data: replacement_desc.update_custom_replacement_attributes(graph) self.save_custom_replacement_config_file(data, file_name)