Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
Hello World
Manage
Activity
Members
Labels
Plan
Issues
6
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OST
SA
projects
Hello World
Commits
48c9bf5b
Commit
48c9bf5b
authored
1 year ago
by
Andri Joos
Browse files
Options
Downloads
Patches
Plain Diff
add tf_lite_export
parent
cd309aad
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
export_import/tf_lite_export.py
+17
-0
17 additions, 0 deletions
export_import/tf_lite_export.py
with
17 additions
and
0 deletions
export_import/tf_lite_export.py
0 → 100644
+
17
−
0
View file @
48c9bf5b
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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment