Move tf.cast to tf.float16 in input pipeline #5253
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Moves the tf.cast for tf.float16 to the input pipeline which is run on cpu and pipelined. This seemed to have a consistent ~50 images/sec boost on 8xV100 FP16 with real imagenet data, which is a small 1% gain and logical.
FYI,
tf.image.per_image_standardization(image)
Returns tf.float32 even if passed a tf.float16 tensor thus the cast to tf.float16 must be done after preprocessing.