Skip to content

Propagate the error string of GIF processing for decode_gif - #16113

Merged
rmlarsen merged 3 commits into
tensorflow:masterfrom
yongtang:15838-decode_gif-error
Jan 23, 2018
Merged

rmlarsen merged 3 commits into
tensorflow:masterfrom
yongtang:15838-decode_gif-error

Conversation

@yongtang

Copy link
Copy Markdown
Member

This fix tries to improve the error thrown by decode_gif to include the error string generated by GIF processing.

Previously, the error was not very indicative as the error string
returned by GIF processing was hidden:

..........
InvalidArgumentError (see above for traceback): Invalid GIF data, size 2091369
	 [[Node: DecodeGif = DecodeGif[_device="/job:localhost/replica:0/task:0/device:CPU:0"](ReadFile)]]

This fix propagate the error string (can't process optimized gif) to be part of the InvalidArgumentError:

InvalidArgumentError (see above for traceback): Invalid GIF data (size 2091369), can't process optimized gif
         [[Node: DecodeGif = DecodeGif[_device="/job:localhost/replica:0/task:0/device:CPU:0"](ReadFile)]]

This fix fixes #15838.

Signed-off-by: Yong Tang [email protected]

…r `decode_gif`

This fix tries to improve the error thrown by `decode_gif`
to include the error string generated by GIF processing.

Previously, the error was not very indicative as the error string
returned by GIF processing was hidden:
```
..........
InvalidArgumentError (see above for traceback): Invalid GIF data, size 2091369
	 [[Node: DecodeGif = DecodeGif[_device="/job:localhost/replica:0/task:0/device:CPU:0"](ReadFile)]]
```

This fix propagate the error string to be part of the `InvalidArgumentError`:
```
InvalidArgumentError (see above for traceback): Invalid GIF data (size 2091369), can't process optimized gif
         [[Node: DecodeGif = DecodeGif[_device="/job:localhost/replica:0/task:0/device:CPU:0"](ReadFile)]]
```

This fix fixes 15838.

Signed-off-by: Yong Tang <[email protected]>

uint8* Decode(const void* srcdata, int datasize,
std::function<uint8*(int, int, int, int)> allocate_output);
std::function<uint8*(int, int, int, int)> allocate_output,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a unit test for the new functionality.

@rmlarsen rmlarsen self-assigned this Jan 22, 2018
@rmlarsen rmlarsen added the stat:awaiting response Status - Awaiting response from author label Jan 22, 2018
so that error messages like `can't process optimized gif` are
propagated to the exception of `InvalidArgumentError`.

Signed-off-by: Yong Tang <[email protected]>
@yongtang

Copy link
Copy Markdown
Member Author

Thanks @rmlarsen for the review. A unit test testOptimizedGifErrorString has been added to image_ops_test.py. Please take a look and let me know if there are any issues.

@rmlarsen
rmlarsen merged commit 7c53bc7 into tensorflow:master Jan 23, 2018
@yongtang
yongtang deleted the 15838-decode_gif-error branch January 23, 2018 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes stat:awaiting response Status - Awaiting response from author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gif can't be decoded. InvalidArgumentError: Invalid GIF data

3 participants