LostTech.TensorFlow : API Documentation

Type TFLiteConverter

Namespace tensorflow.lite

Parent TFLiteConverterBase

Interfaces ITFLiteConverter

Public instance methods

IList<object> get_input_arrays()

Returns a list of the names of the input tensors.
Returns
IList<object>
List of strings.

object get_input_arrays_dyn()

Returns a list of the names of the input tensors.
Returns
object
List of strings.

Public static methods

object from_frozen_graph_dyn<TClass>(object graph_def_file, object input_arrays, object output_arrays, object input_shapes)

Creates a TFLiteConverter class from a file containing a frozen GraphDef.
Parameters
object graph_def_file
Full filepath of file containing frozen GraphDef.
object input_arrays
List of input tensors to freeze graph with.
object output_arrays
List of output tensors to freeze graph with.
object input_shapes
Dict of strings representing input tensor names to list of integers representing input shapes (e.g., {"foo" : [1, 16, 16, 3]}). Automatically determined when input shapes is None (e.g., {"foo" : None}). (default None)
Returns
object
TFLiteConverter class.

TClass from_frozen_graph<TClass>(string graph_def_file, IEnumerable<string> input_arrays, IEnumerable<string> output_arrays, IDictionary<string, IEnumerable<int>> input_shapes)

Creates a TFLiteConverter class from a file containing a frozen GraphDef.
Parameters
string graph_def_file
Full filepath of file containing frozen GraphDef.
IEnumerable<string> input_arrays
List of input tensors to freeze graph with.
IEnumerable<string> output_arrays
List of output tensors to freeze graph with.
IDictionary<string, IEnumerable<int>> input_shapes
Dict of strings representing input tensor names to list of integers representing input shapes (e.g., {"foo" : [1, 16, 16, 3]}). Automatically determined when input shapes is None (e.g., {"foo" : None}). (default None)
Returns
TClass
TFLiteConverter class.

object from_keras_model_file_dyn<TClass>(object model_file, object input_arrays, object input_shapes, object output_arrays, object custom_objects)

Creates a TFLiteConverter class from a tf.keras model file.
Parameters
object model_file
Full filepath of HDF5 file containing the tf.keras model.
object input_arrays
List of input tensors to freeze graph with. Uses input arrays from SignatureDef when none are provided. (default None)
object input_shapes
Dict of strings representing input tensor names to list of integers representing input shapes (e.g., {"foo" : [1, 16, 16, 3]}). Automatically determined when input shapes is None (e.g., {"foo" : None}). (default None)
object output_arrays
List of output tensors to freeze graph with. Uses output arrays from SignatureDef when none are provided. (default None)
object custom_objects
Dict mapping names (strings) to custom classes or functions to be considered during model deserialization. (default None)
Returns
object
TFLiteConverter class.

TClass from_keras_model_file<TClass>(string model_file, IEnumerable<string> input_arrays, IDictionary<string, IEnumerable<int>> input_shapes, IEnumerable<string> output_arrays, IDictionary<string, PythonClassContainer> custom_objects)

Creates a TFLiteConverter class from a tf.keras model file.
Parameters
string model_file
Full filepath of HDF5 file containing the tf.keras model.
IEnumerable<string> input_arrays
List of input tensors to freeze graph with. Uses input arrays from SignatureDef when none are provided. (default None)
IDictionary<string, IEnumerable<int>> input_shapes
Dict of strings representing input tensor names to list of integers representing input shapes (e.g., {"foo" : [1, 16, 16, 3]}). Automatically determined when input shapes is None (e.g., {"foo" : None}). (default None)
IEnumerable<string> output_arrays
List of output tensors to freeze graph with. Uses output arrays from SignatureDef when none are provided. (default None)
IDictionary<string, PythonClassContainer> custom_objects
Dict mapping names (strings) to custom classes or functions to be considered during model deserialization. (default None)
Returns
TClass
TFLiteConverter class.

object from_saved_model_dyn<TClass>(object saved_model_dir, object input_arrays, object input_shapes, object output_arrays, object tag_set, object signature_key)

Creates a TFLiteConverter class from a SavedModel.
Parameters
object saved_model_dir
SavedModel directory to convert.
object input_arrays
List of input tensors to freeze graph with. Uses input arrays from SignatureDef when none are provided. (default None)
object input_shapes
Dict of strings representing input tensor names to list of integers representing input shapes (e.g., {"foo" : [1, 16, 16, 3]}). Automatically determined when input shapes is None (e.g., {"foo" : None}). (default None)
object output_arrays
List of output tensors to freeze graph with. Uses output arrays from SignatureDef when none are provided. (default None)
object tag_set
Set of tags identifying the MetaGraphDef within the SavedModel to analyze. All tags in the tag set must be present. (default set("serve"))
object signature_key
Key identifying SignatureDef containing inputs and outputs. (default DEFAULT_SERVING_SIGNATURE_DEF_KEY)
Returns
object
TFLiteConverter class.

TClass from_saved_model<TClass>(object saved_model_dir, IEnumerable<string> input_arrays, IDictionary<string, IEnumerable<int>> input_shapes, object output_arrays, object tag_set, object signature_key)

Creates a TFLiteConverter class from a SavedModel.
Parameters
object saved_model_dir
SavedModel directory to convert.
IEnumerable<string> input_arrays
List of input tensors to freeze graph with. Uses input arrays from SignatureDef when none are provided. (default None)
IDictionary<string, IEnumerable<int>> input_shapes
Dict of strings representing input tensor names to list of integers representing input shapes (e.g., {"foo" : [1, 16, 16, 3]}). Automatically determined when input shapes is None (e.g., {"foo" : None}). (default None)
object output_arrays
List of output tensors to freeze graph with. Uses output arrays from SignatureDef when none are provided. (default None)
object tag_set
Set of tags identifying the MetaGraphDef within the SavedModel to analyze. All tags in the tag set must be present. (default set("serve"))
object signature_key
Key identifying SignatureDef containing inputs and outputs. (default DEFAULT_SERVING_SIGNATURE_DEF_KEY)
Returns
TClass
TFLiteConverter class.

object from_session_dyn<TClass>(object sess, object input_tensors, object output_tensors)

Creates a TFLiteConverter class from a TensorFlow Session.
Parameters
object sess
TensorFlow Session.
object input_tensors
List of input tensors. Type and shape are computed using `foo.shape` and `foo.dtype`.
object output_tensors
List of output tensors (only.name is used from this).
Returns
object
TFLiteConverter class.

TClass from_session<TClass>(Session sess, IEnumerable<IGraphNodeBase> input_tensors, IEnumerable<object> output_tensors)

Creates a TFLiteConverter class from a TensorFlow Session.
Parameters
Session sess
TensorFlow Session.
IEnumerable<IGraphNodeBase> input_tensors
List of input tensors. Type and shape are computed using `foo.shape` and `foo.dtype`.
IEnumerable<object> output_tensors
List of output tensors (only.name is used from this).
Returns
TClass
TFLiteConverter class.

Public properties

bool allow_custom_ops get; set;

bool change_concat_input_ranges get; set;

Nullable<ValueTuple<int, int>> default_ranges_stats get; set;

bool drop_control_dependency get; set;

object dump_graphviz_dir get; set;

bool dump_graphviz_video get; set;

bool experimental_enable_mlir_converter get; set;

DType inference_input_type get; set;

DType inference_output_type get; set;

DType inference_type get; set;

IList<object> optimizations get; set;

int output_format get; set;

object PythonObject get;

IDictionary<string, ValueTuple<double, object>> quantized_input_stats get; set;

bool reorder_across_fake_quant get; set;

RepresentativeDataset representative_dataset get; set;

TargetSpec target_spec get; set;