Creates a `Dataset` with a single element, comprising 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 m
(tensors)
| 448 | |
| 449 | @staticmethod |
| 450 | def from_tensors(tensors): |
| 451 | """Creates a `Dataset` with a single element, comprising the given tensors. |
| 452 | |
| 453 | Note that if `tensors` contains a NumPy array, and eager execution is not |
| 454 | enabled, the values will be embedded in the graph as one or more |
| 455 | `tf.constant` operations. For large datasets (> 1 GB), this can waste |
| 456 | memory and run into byte limits of graph serialization. If `tensors` |
| 457 | contains one or more large NumPy arrays, consider the alternative described |
| 458 | in [this |
| 459 | guide](https://tensorflow.org/guide/datasets#consuming_numpy_arrays). |
| 460 | |
| 461 | Args: |
| 462 | tensors: A dataset element. |
| 463 | |
| 464 | Returns: |
| 465 | Dataset: A `Dataset`. |
| 466 | """ |
| 467 | return TensorDataset(tensors) |
| 468 | |
| 469 | @staticmethod |
| 470 | def from_tensor_slices(tensors): |