util.importGraphIntoSession(sess, frozen_pb_path, "")
try:
- tflite_model = tf.contrib.lite.toco_convert(sess.graph_def, input_node_list,
- output_node_list)
+ converter = tf.contrib.lite.TFLiteConverter.from_session(
+ sess, input_node_list, output_node_list)
+ tflite_model = converter.convert()
open(tflite_path, "wb").write(tflite_model)
print("# 3. TOCO : Created TFLITE file :\n\t-{}\n".format(tflite_path))
except Exception:
+## Prerequisites
+
+The scripts here use TensorFlow's tools, so you need an environment to run TensorFlow. Running the scripts within this tutorial requires:
+
+* Install [TensorFlow](https://www.tensorflow.org/install/) v1.12 or later
+ * Use pip
+ ```
+ $ pip install tensorflow==1.12
+ ```
+
## What this tool is about
This tool generaes the following files:
"mul_1d_scalarConst": [base.Tensor([5]),
base.Tensor([], const_val=1.1)], # mul by scalar
"mul_2d_scalarConst": [base.Tensor([5, 3]),
- base.Tensor([], const_val=1.1)],
- "mul_1d_scalar": [base.Tensor([5, 3]), base.Tensor([])]
+ base.Tensor([], const_val=1.1)]
+ # "mul_2d_scalar": [base.Tensor([5, 3]), base.Tensor([])] # not support scalar input
}
def buildModel(self, sess, test_case_tensor, tc_name):
'''
input_list = []
+ output_list = []
# ------ modify below for your model FROM here -------#
y_tensor = self.createTFInput(test_case_tensor[1], input_list)
# defining output node and input list
- output_node = tf.nn.top_k(
+ values_op, indices_op = tf.nn.top_k(
x_tensor,
y_tensor, # add your input here
name=tc_name) # do not modify name
+ output_list.append(values_op)
+ output_list.append(indices_op)
# ------ modify UNTIL here for your model -------#
# Note if don't have any CONST value, creating checkpoint file fails.
# ------ modify appropriate return value -------#
# returning (input_node_list, output_node_list)
- return (input_list, [output_node])
+ return (input_list, output_list)
'''