Created
October 15, 2022 12:06
-
-
Save OhadRubin/92e6f6a5e686844420c2e1b17811e463 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hf_features_to_tf_features(features): | |
output_types= {} | |
output_shapes = {} | |
for x,y in features.items(): | |
output_types[x] = getattr(tf.dtypes,y.dtype) if y.dtype!="list" else getattr(tf.dtypes,y.feature.dtype) | |
output_shapes[x] = [] if y.dtype!="list" else [None] | |
return dict(output_types=output_types,output_shapes=output_shapes) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment