I used :import tensorflow as tf
from tensorflow.python.framework.convert_to_constants import convert_variables_to_constants_v2
model_url = “TensorFlow Hub 1”
imported = hub.load(model_url)
concrete_func = imported.call.get_concrete_function( tf.TensorSpec(shape=(1, 1024, 1024, 3), dtype=tf.uint8))
#concrete_func = imported.signatures[’__saved_model_init_op’]
frozen_func = convert_variables_to_constants_v2(concrete_func, lower_control_flow=False)
graph_def = frozen_func.graph.as_graph_def(add_shapes=True)
with tf.Graph().as_default() as inferred_graph:
tf.import_graph_def(graph_def, name="")
print(tf.mlir.experimental.convert_graph_def(
graph_def, pass_pipeline=‘tf-standard-pipeline’
))
mlir file got generated .and then tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt --tf-executor-to-functional-conversion --tf-shape-inference -xla-legalize-tf --print-ir-before-all --print-ir-after-all &>sample ex.mlir
I got error as error: unknown TensorFlow type: uint8
%1106 = “tf.Placeholder”() {_output_shapes = [“tfshape$dim { size: 1 } dim { size: -1 } dim { size: -1 } dim { size: 3 }”], device = “”, dtype = “tfdtype$DT_UINT8”, name = “input_tensor”, shape = “tfshape$dim { size: 1 } dim { size: -1 } dim { size: -1 } dim { size: 3 }”} : () → tensor<1x?x?x3x!tf.uint8>