MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / __init__

Method __init__

tensorflow/lite/python/lite.py:560–613  ·  view source on GitHub ↗

Constructor for TFLiteConverter. Args: graph_def: Frozen TensorFlow GraphDef. input_tensors: List of input tensors. Type and shape are computed using `foo.shape` and `foo.dtype`. output_tensors: List of output tensors (only .name is used from this). input_arrays_

(self,
               graph_def,
               input_tensors,
               output_tensors,
               input_arrays_with_shape=None,
               output_arrays=None,
               experimental_debug_info_func=None)

Source from the content-addressed store, hash-verified

558 """
559
560 def __init__(self,
561 graph_def,
562 input_tensors,
563 output_tensors,
564 input_arrays_with_shape=None,
565 output_arrays=None,
566 experimental_debug_info_func=None):
567 """Constructor for TFLiteConverter.
568
569 Args:
570 graph_def: Frozen TensorFlow GraphDef.
571 input_tensors: List of input tensors. Type and shape are computed using
572 `foo.shape` and `foo.dtype`.
573 output_tensors: List of output tensors (only .name is used from this).
574 input_arrays_with_shape: Tuple of strings representing input tensor names
575 and list of integers representing input shapes
576 (e.g., [("foo" : [1, 16, 16, 3])]). Use only when graph cannot be loaded
577 into TensorFlow and when `input_tensors` and `output_tensors` are
578 None. (default None)
579 output_arrays: List of output tensors to freeze graph with. Use only when
580 graph cannot be loaded into TensorFlow and when `input_tensors` and
581 `output_tensors` are None. (default None)
582 experimental_debug_info_func: An experimental function to retrieve the
583 graph debug info for a set of nodes from the `graph_def`.
584
585 Raises:
586 ValueError: Invalid arguments.
587 """
588 super(TFLiteConverter, self).__init__()
589 self._graph_def = graph_def
590 self._input_tensors = input_tensors
591 self._output_tensors = output_tensors
592 self.inference_type = constants.FLOAT
593 self.inference_input_type = None
594 self.inference_output_type = None
595 self.output_format = constants.TFLITE
596 self.quantized_input_stats = {}
597 self.default_ranges_stats = None
598 self.drop_control_dependency = True
599 self.reorder_across_fake_quant = False
600 self.change_concat_input_ranges = False
601 self._post_training_quantize = False
602 self.dump_graphviz_dir = None
603 self.dump_graphviz_video = False
604 self._debug_info_func = experimental_debug_info_func
605
606 # Attributes are used by models that cannot be loaded into TensorFlow.
607 if not self._has_valid_tensors():
608 if not input_arrays_with_shape or not output_arrays:
609 raise ValueError(
610 "If input_tensors and output_tensors are None, both "
611 "input_arrays_with_shape and output_arrays must be defined.")
612 self._input_arrays_with_shape = input_arrays_with_shape
613 self._output_arrays = output_arrays
614
615 @classmethod
616 def from_session(cls, sess, input_tensors, output_tensors):

Callers

nothing calls this directly

Calls 2

_has_valid_tensorsMethod · 0.95
__init__Method · 0.45

Tested by

no test coverage detected