Skip to content
Snippets Groups Projects
Commit 48c9bf5b authored by Andri Joos's avatar Andri Joos :blush:
Browse files

add tf_lite_export

parent cd309aad
No related branches found
No related tags found
No related merge requests found
import tensorflow as tf
import sys
import os
import tensorflow_probability as tfp # fails otherwise
policies_dir = "out/policies"
policy_name = sys.argv[1]
policy_dir = os.path.join(policies_dir, policy_name)
converter = tf.lite.TFLiteConverter.from_saved_model(policy_dir, signature_keys=["action"])
tflite_policy = converter.convert()
tflite_dir = os.path.join(policies_dir, '{}.tflite'.format(policy_name))
with open(tflite_dir, 'wb') as f:
f.write(tflite_policy)
print(tflite_dir)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment