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

Method zip

tensorflow/python/data/ops/dataset_ops.py:761–797  ·  view source on GitHub ↗

Creates a `Dataset` by zipping together the given datasets. This method has similar semantics to the built-in `zip()` function in Python, with the main difference being that the `datasets` argument can be an arbitrary nested structure of `Dataset` objects. For example: ```pytho

(datasets)

Source from the content-addressed store, hash-verified

759
760 @staticmethod
761 def zip(datasets):
762 """Creates a `Dataset` by zipping together the given datasets.
763
764 This method has similar semantics to the built-in `zip()` function
765 in Python, with the main difference being that the `datasets`
766 argument can be an arbitrary nested structure of `Dataset` objects.
767 For example:
768
769 ```python
770 a = Dataset.range(1, 4) # ==> [ 1, 2, 3 ]
771 b = Dataset.range(4, 7) # ==> [ 4, 5, 6 ]
772 c = Dataset.range(7, 13).batch(2) # ==> [ [7, 8], [9, 10], [11, 12] ]
773 d = Dataset.range(13, 15) # ==> [ 13, 14 ]
774
775 # The nested structure of the `datasets` argument determines the
776 # structure of elements in the resulting dataset.
777 Dataset.zip((a, b)) # ==> [ (1, 4), (2, 5), (3, 6) ]
778 Dataset.zip((b, a)) # ==> [ (4, 1), (5, 2), (6, 3) ]
779
780 # The `datasets` argument may contain an arbitrary number of
781 # datasets.
782 Dataset.zip((a, b, c)) # ==> [ (1, 4, [7, 8]),
783 # (2, 5, [9, 10]),
784 # (3, 6, [11, 12]) ]
785
786 # The number of elements in the resulting dataset is the same as
787 # the size of the smallest dataset in `datasets`.
788 Dataset.zip((a, d)) # ==> [ (1, 13), (2, 14) ]
789 ```
790
791 Args:
792 datasets: A nested structure of datasets.
793
794 Returns:
795 Dataset: A `Dataset`.
796 """
797 return ZipDataset(datasets)
798
799 def concatenate(self, dataset):
800 """Creates a `Dataset` by concatenating the given dataset with this dataset.

Callers 15

build_model_inputFunction · 0.45
testNestedOutputsMethod · 0.45
_benchmark_trainMethod · 0.45
train_input_fnFunction · 0.45
eval_input_fnFunction · 0.45
_makeSimpleDatasetMethod · 0.45
testGradientClippingMethod · 0.45
dataset_fnMethod · 0.45
testNestedZipDatasetMethod · 0.45

Calls 1

ZipDatasetClass · 0.70