IQ.Pilot Prebuilt Release @ 27f668a
This commit is contained in:
17
iqpilot/selfdrive/iqmodeld/tests/tf_test/build.sh
Executable file
17
iqpilot/selfdrive/iqmodeld/tests/tf_test/build.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright © IQ.Lvbs, apart of Project Teal Lvbs, All Rights Reserved, licensed under https://konn3kt.com/tos/
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
TF_ROOT="${TF_ROOT:-/home/batman/one/external/tensorflow}"
|
||||
TF_INCLUDE_DIR="${TF_INCLUDE_DIR:-$TF_ROOT/include}"
|
||||
TF_LIB_DIR="${TF_LIB_DIR:-$TF_ROOT/lib}"
|
||||
CXX="${CXX:-clang++}"
|
||||
|
||||
exec "$CXX" \
|
||||
-std=c++17 \
|
||||
-I "$TF_INCLUDE_DIR" \
|
||||
-L "$TF_LIB_DIR" \
|
||||
-Wl,-rpath="$TF_LIB_DIR" \
|
||||
main.cc \
|
||||
-ltensorflow
|
||||
32
iqpilot/selfdrive/iqmodeld/tests/tf_test/pb_loader.py
Executable file
32
iqpilot/selfdrive/iqmodeld/tests/tf_test/pb_loader.py
Executable file
@@ -0,0 +1,32 @@
|
||||
"""
|
||||
Copyright © IQ.Lvbs, apart of Project Teal Lvbs, All Rights Reserved, licensed under https://konn3kt.com/tos/
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import tensorflow as tf
|
||||
|
||||
|
||||
def _load_graph_bytes(graph_path: Path) -> bytes:
|
||||
return graph_path.read_bytes()
|
||||
|
||||
|
||||
def _parse_graph(graph_path: Path) -> tf.compat.v1.GraphDef:
|
||||
graph = tf.compat.v1.GraphDef()
|
||||
graph.ParseFromString(_load_graph_bytes(graph_path))
|
||||
return graph
|
||||
|
||||
|
||||
def main(argv: list[str]) -> int:
|
||||
if len(argv) < 2:
|
||||
print("Usage: pb_loader.py <graph.pb>")
|
||||
return 1
|
||||
_parse_graph(Path(argv[1]))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main(sys.argv))
|
||||
Reference in New Issue
Block a user