Last active
February 25, 2020 18:23
-
-
Save BryanCutler/bc9cbb707f33d59413a23789431866ff to your computer and use it in GitHub Desktop.
TensorFlow Arrow Blog Part 11 - Model Training Remote Dataset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_remote_dataset(endpoint): | |
"""Make a TensorFlow Arrow Dataset that reads from a remote Arrow stream.""" | |
# Create the Arrow Dataset from a remote host serving a stream | |
ds = arrow_io.ArrowStreamDataset( | |
[endpoint], | |
columns=(0, 1, 2), | |
output_types=(tf.int64, tf.float64, tf.float64), | |
output_shapes=(tf.TensorShape([]), tf.TensorShape([]), tf.TensorShape([])), | |
batch_mode='auto') | |
# Map the dataset to combine feature columns to single tensor | |
ds = ds.map(lambda l, x0, x1: (tf.stack([x0, x1], axis=1), l)) | |
return ds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment