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)
| 679 | |
| 680 | |
| 681 | def _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 | |
| 712 | def _select_which_to_enqueue(tensor_list, keep_input): |
no test coverage detected