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

Function _shapes

tensorflow/python/training/input.py:681–709  ·  view source on GitHub ↗

Calculate and merge the shapes of incoming tensors. Args: tensor_list_list: List of tensor lists. shapes: List of shape tuples corresponding to tensors within the lists. enqueue_many: Boolean describing whether shapes will be enqueued as batches or individual entries. Returns

(tensor_list_list, shapes, enqueue_many)

Source from the content-addressed store, hash-verified

679
680
681def _shapes(tensor_list_list, shapes, enqueue_many):
682 """Calculate and merge the shapes of incoming tensors.
683
684 Args:
685 tensor_list_list: List of tensor lists.
686 shapes: List of shape tuples corresponding to tensors within the lists.
687 enqueue_many: Boolean describing whether shapes will be enqueued as
688 batches or individual entries.
689
690 Returns:
691 A list of shapes aggregating shape inference info from `tensor_list_list`,
692 or returning `shapes` if it is not `None`.
693
694 Raises:
695 ValueError: If any of the inferred shapes in `tensor_list_list` lack a
696 well defined rank.
697 """
698 if shapes is None:
699 len0 = len(tensor_list_list[0])
700
701 for tl in tensor_list_list:
702 for i in xrange(len0):
703 if tl[i].shape.ndims is None:
704 raise ValueError("Cannot infer Tensor's rank: %s" % tl[i])
705
706 shapes = [_merge_shapes(
707 [tl[i].shape.as_list() for tl in tensor_list_list], enqueue_many)
708 for i in xrange(len0)]
709 return shapes
710
711
712def _select_which_to_enqueue(tensor_list, keep_input):

Callers 5

bucketFunction · 0.85
_batchFunction · 0.85
_batch_joinFunction · 0.85
_shuffle_batchFunction · 0.85
_shuffle_batch_joinFunction · 0.85

Calls 2

_merge_shapesFunction · 0.85
as_listMethod · 0.45

Tested by

no test coverage detected