Converts a graphdef with LiteOp hints into stub operations. This is used to prepare for toco conversion of complex intrinsic usages. Note: only one of session or graph_def should be used, not both. Args: session: A TensorFlow session that contains the graph to convert. graph_def: A g
(session=None,
graph_def=None,
write_callback=lambda graph_def, comments: None)
| 1260 | |
| 1261 | @_tf_export(v1=["lite.experimental.convert_op_hints_to_stubs"]) |
| 1262 | def convert_op_hints_to_stubs(session=None, |
| 1263 | graph_def=None, |
| 1264 | write_callback=lambda graph_def, comments: None): |
| 1265 | """Converts a graphdef with LiteOp hints into stub operations. |
| 1266 | |
| 1267 | This is used to prepare for toco conversion of complex intrinsic usages. |
| 1268 | Note: only one of session or graph_def should be used, not both. |
| 1269 | |
| 1270 | Args: |
| 1271 | session: A TensorFlow session that contains the graph to convert. |
| 1272 | graph_def: A graph def that we should convert. |
| 1273 | write_callback: A function pointer that can be used to write intermediate |
| 1274 | steps of graph transformation (optional). |
| 1275 | Returns: |
| 1276 | A new graphdef with all ops contained in OpHints being replaced by |
| 1277 | a single op call with the right parameters. |
| 1278 | Raises: |
| 1279 | ValueError: If both session and graph_def are provided. |
| 1280 | """ |
| 1281 | |
| 1282 | if session is not None and graph_def is not None: |
| 1283 | raise ValueError("Provide only one of session and graph_def.") |
| 1284 | |
| 1285 | if session is not None: |
| 1286 | return _convert_op_hints_to_stubs_helper(session.graph_def, write_callback) |
| 1287 | elif graph_def is not None: |
| 1288 | return _convert_op_hints_to_stubs_helper(graph_def, write_callback) |
| 1289 | else: |
| 1290 | raise ValueError("Must specify session or graph_def as input.") |
| 1291 | |
| 1292 | |
| 1293 | _allowed_symbols = [ |
no test coverage detected