Created
May 24, 2020 00:47
-
-
Save hanneshapke/7446513f5a1832bce9e9c25a842514f8 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 _get_serve_tf_examples_fn(model, tf_transform_output): | |
model.tft_layer = tf_transform_output.transform_features_layer() | |
@tf.function | |
def serve_tf_examples_fn(serialized_tf_examples): | |
feature_spec = tf_transform_output.raw_feature_spec() | |
feature_spec.pop(_LABEL_KEY) | |
parsed_features = tf.io.parse_example(serialized_tf_examples, feature_spec) | |
transformed_features = model.tft_layer(parsed_features) | |
return model(transformed_features) | |
return serve_tf_examples_fn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment