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
import tensorflow as tf | |
# Save model to pb file (SavedModel format) | |
tf.saved_model.save(meta_learnen, model_dir, signatures=meta_learner.call) | |
print('pb file saved') | |
# Optimize SavedModel with tflite | |
converter = tf.lite.TFLiteConverter.from_saved_model(model_dir) | |
converter.target_ops = [tf.lite.OpsSet.TFLITE_BUILTINS, | |
tf.lite.OpsSet.SELECT_TF_OPS] |
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
import tensorflow as tf | |
from tensorflow.keras import Model, layers | |
class GestureMetaLearner(Model): | |
def __init__(self, batch_size, spectral_lvls, num_sensors, window_len_snc, window_len_imu, is_training=True): | |
super(GestureMetaLearner, self).__init__() | |
# NN high-level params | |
self.params1 = 1 | |
self.params2 = 2 |
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
#include "TensorflowInference.h" | |
// This is the "feed_dict" key value pair (we have a vector of these for multiple inputs definition) | |
typedef vector<pair<const char *, vector<long long>>> ModelInputType; | |
ModelInputType m_modeInputsDefs; | |
// Using floats for example as input \ output | |
typedef std::vector<float> BufferType; | |
// Resize to NUM_OF_INPUTS |
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
bazel build -c opt --copt="-fPIC" --cxxopt='-std=c++11' --crosstool_top=//external:android/crosstool --cpu=arm64-v8a --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --config monolithic tensorflow/tools/tfwld:libTensorflowInference.so |
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
bazel build -c opt --copt="-fPIC" --cxxopt='-std=c++11' --crosstool_top=//external:android/crosstool --cpu=arm64-v8a --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --config monolithic tensorflow/tools/tfwld:libTensorflowInference.so |
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
package(default_visibility = ["//visibility:public"]) | |
load( | |
"//tensorflow:tensorflow.bzl", | |
"tf_copts", | |
"tf_cc_test", | |
"tf_cc_binary", | |
) | |
cc_library( |