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

Method from_tensor_slices

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

Creates a `Dataset` whose elements are slices of the given tensors. Note that if `tensors` contains a NumPy array, and eager execution is not enabled, the values will be embedded in the graph as one or more `tf.constant` operations. For large datasets (> 1 GB), this can waste memory

(tensors)

Source from the content-addressed store, hash-verified

468
469 @staticmethod
470 def from_tensor_slices(tensors):
471 """Creates a `Dataset` whose elements are slices of the given tensors.
472
473 Note that if `tensors` contains a NumPy array, and eager execution is not
474 enabled, the values will be embedded in the graph as one or more
475 `tf.constant` operations. For large datasets (> 1 GB), this can waste
476 memory and run into byte limits of graph serialization. If `tensors`
477 contains one or more large NumPy arrays, consider the alternative described
478 in [this guide](
479 https://tensorflow.org/guide/datasets#consuming_numpy_arrays).
480
481 Args:
482 tensors: A dataset element, with each component having the same size in
483 the 0th dimension.
484
485 Returns:
486 Dataset: A `Dataset`.
487 """
488 return TensorSliceDataset(tensors)
489
490 class _GeneratorState(object):
491 """Stores outstanding iterators created from a Python generator.

Calls 1

TensorSliceDatasetClass · 0.70