Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
809eaba9
Commit
809eaba9
authored
Mar 23, 2022
by
Fan Yang
Committed by
A. Unique TensorFlower
Mar 23, 2022
Browse files
Support reading compressed tfrecord files.
PiperOrigin-RevId: 436868704
parent
d479abde
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
official/common/dataset_fn.py
official/common/dataset_fn.py
+4
-2
No files found.
official/common/dataset_fn.py
View file @
809eaba9
...
...
@@ -28,7 +28,8 @@
# ==============================================================================
"""Utility library for picking an appropriate dataset function."""
from
typing
import
Any
,
Callable
,
Union
,
Type
import
functools
from
typing
import
Any
,
Callable
,
Type
,
Union
import
tensorflow
as
tf
...
...
@@ -38,5 +39,6 @@ PossibleDatasetType = Union[Type[tf.data.Dataset], Callable[[tf.Tensor], Any]]
def
pick_dataset_fn
(
file_type
:
str
)
->
PossibleDatasetType
:
if
file_type
==
'tfrecord'
:
return
tf
.
data
.
TFRecordDataset
if
file_type
==
'tfrecord_compressed'
:
return
functools
.
partial
(
tf
.
data
.
TFRecordDataset
,
compression_type
=
'GZIP'
)
raise
ValueError
(
'Unrecognized file_type: {}'
.
format
(
file_type
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment