Skip to content

Commit 1344a17

Browse files
authored
Enable use of png input images.
Replacing `decode_jpeg` by the generic `decode_image` and setting up `channels=3` allows the use of this util function to work with PNG images, which come with 4 channels.
1 parent 77b55f9 commit 1344a17

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

site/en/r2/tutorials/generative/style_transfer.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@
241241
"def load_img(path_to_img):\n",
242242
" max_dim = 512\n",
243243
" img = tf.io.read_file(path_to_img)\n",
244-
" img = tf.image.decode_jpeg(img)\n",
244+
" img = tf.image.decode_image(img, channels=3)\n",
245245
" img = tf.image.convert_image_dtype(img, tf.float32)\n",
246246
"\n",
247247
" shape = tf.cast(tf.shape(img)[:-1], tf.float32)\n",

0 commit comments

Comments
 (0)