From a071714cfb0a937d0ca9c5ecdc05c1d60ea0df86 Mon Sep 17 00:00:00 2001 From: Sayantan Das <36279638+ucalyptus@users.noreply.github.com> Date: Sat, 11 Apr 2020 17:02:23 +0530 Subject: [PATCH] Update utils.py --- 10-ColorBot/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/10-ColorBot/utils.py b/10-ColorBot/utils.py index 996e4bd..8812872 100644 --- a/10-ColorBot/utils.py +++ b/10-ColorBot/utils.py @@ -13,8 +13,8 @@ def parse(line): # Each line of the dataset is comma-separated and formatted as # color_name, r, g, b # so `items` is a list [color_name, r, g, b]. - items = tf.string_split([line], ",").values - rgb = tf.strings.to_number(items[1:], out_type=tf.float32) / 255. + items = tf.compat.v1.string_split([line], ",").values + rgb = tf.compat.v1.strings.to_number(items[1:], out_type=tf.float32) / 255. # Represent the color name as a one-hot encoded character sequence. color_name = items[0] chars = tf.one_hot(tf.io.decode_raw(color_name, tf.uint8), depth=256) @@ -60,4 +60,4 @@ def load_dataset(data_dir, url, batch_size): dataset = tf.data.TextLineDataset(path).skip(1).map(parse).shuffle( buffer_size=10000).padded_batch( batch_size, padded_shapes=([None], [None, None], [])) - return dataset \ No newline at end of file + return dataset