MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _GatherReturnElements

Function _GatherReturnElements

tensorflow/python/framework/importer.py:307–333  ·  view source on GitHub ↗

Returns the requested return elements from results. Args: requested_return_elements: list of strings of operation and tensor names graph: Graph results: wrapped TF_ImportGraphDefResults Returns: list of `Operation` and/or `Tensor` objects

(requested_return_elements, graph, results)

Source from the content-addressed store, hash-verified

305
306
307def _GatherReturnElements(requested_return_elements, graph, results):
308 """Returns the requested return elements from results.
309
310 Args:
311 requested_return_elements: list of strings of operation and tensor names
312 graph: Graph
313 results: wrapped TF_ImportGraphDefResults
314
315 Returns:
316 list of `Operation` and/or `Tensor` objects
317 """
318 return_outputs = c_api.TF_ImportGraphDefResultsReturnOutputs(results)
319 return_opers = c_api.TF_ImportGraphDefResultsReturnOperations(results)
320
321 combined_return_elements = []
322 outputs_idx = 0
323 opers_idx = 0
324 for name in requested_return_elements:
325 if ':' in name:
326 combined_return_elements.append(
327 graph._get_tensor_by_tf_output(return_outputs[outputs_idx])) # pylint: disable=protected-access
328 outputs_idx += 1
329 else:
330 combined_return_elements.append(
331 graph._get_operation_by_tf_operation(return_opers[opers_idx])) # pylint: disable=protected-access
332 opers_idx += 1
333 return combined_return_elements
334
335
336def _SetDefaultAttrValues(node_def, op_def):

Callers 1

Calls 3

appendMethod · 0.45

Tested by

no test coverage detected