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

Method build_results

tensorflow/python/client/session.py:528–573  ·  view source on GitHub ↗

Build results matching the original fetch shape. `tensor_values` must be a list of the same length as the one returned by `fetches()`, and holding the requested fetch values. This method builds a struct with the same shape as the original `fetches` passed to the constructor, in

(self, session, tensor_values)

Source from the content-addressed store, hash-verified

526 return self._targets
527
528 def build_results(self, session, tensor_values):
529 """Build results matching the original fetch shape.
530
531 `tensor_values` must be a list of the same length as
532 the one returned by `fetches()`, and holding the requested
533 fetch values.
534
535 This method builds a struct with the same shape as the original `fetches`
536 passed to the constructor, in which the fetches are replaced by their
537 fetched value.
538
539 Args:
540 session: The enclosing session. Used for tensor handles.
541 tensor_values: List of values matching the list returned by fetches().
542
543 Returns:
544 A structure of the same shape as the original `fetches` argument but
545 containing tensors or None (for fetched ops).
546 """
547 full_values = []
548 assert len(self._final_fetches) == len(tensor_values)
549 i = 0
550 j = 0
551 for is_op in self._ops:
552 if is_op:
553 full_values.append(None)
554 else:
555 # If the fetch was in the feeds, use the fed value, otherwise
556 # use the returned value.
557 if self._fetches[i] in self._feed_handles:
558 # A fetch had a corresponding direct TensorHandle feed. Call eval()
559 # to obtain the Tensor value from the TensorHandle.
560 value = self._feed_handles[self._fetches[i]].eval()
561 else:
562 value = self._feeds.get(self._fetches[i])
563 if value is None:
564 value = tensor_values[j]
565 j += 1
566 dtype = self._fetch_handles.get(self._fetches[i])
567 if dtype:
568 full_values.append(session_ops.TensorHandle(value, dtype, session))
569 else:
570 full_values.append(value)
571 i += 1
572 assert j == len(tensor_values)
573 return self._fetch_mapper.build_results(full_values)
574
575
576def _name_list(tensor_list):

Callers

nothing calls this directly

Calls 5

appendMethod · 0.45
evalMethod · 0.45
getMethod · 0.45
TensorHandleMethod · 0.45
build_resultsMethod · 0.45

Tested by

no test coverage detected