tensorflow/lite/python/lite.py
File lite.py
has 2796 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
# Copyright 2023 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Function __init__
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function _quantize
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _quantize(
Function _validate_int8_required
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def _validate_int8_required(self):
"""Int8 mode requires certain parameters to exist and be compatible."""
# Validate target_spec attibute.
if set(self._target_spec.supported_ops) == {
OpsSet.TFLITE_BUILTINS_INT8
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function from_saved_model
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def from_saved_model(
Function from_saved_model
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def from_saved_model(
Function converter_flags
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def converter_flags(self, inference_ty=None, inference_input_ty=None):
"""Flags to the converter."""
if self.is_integer_quantization():
is_low_bit_qat = self.is_low_bit_quantize_aware_training()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function from_keras_model_file
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def from_keras_model_file(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function from_frozen_graph
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def from_frozen_graph(
Function _optimize_tf_model
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _optimize_tf_model(
Function from_frozen_graph
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def from_frozen_graph(
Function from_keras_model_file
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def from_keras_model_file(
Function _optimize_tf_model
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _optimize_tf_model(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(