File quantize_model_test_base.py
has 451 lines of code (exceeds 250 allowed). Consider refactoring. 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 _create_conv2d_model
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_conv2d_model(
Function _prepare_sample_einsum_datashapes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _prepare_sample_einsum_datashapes(
self,
equation: str,
generate_unknown_shape_signature: bool = False,
use_bias: bool = False,
- 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 _create_matmul_and_same_scale_model
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _create_matmul_and_same_scale_model(
self,
input_shape: Sequence[int],
weight_shape: Sequence[int],
saved_model_path: str,
- 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 _get_num_xla_call_module_op
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _get_num_xla_call_module_op(self, output_saved_model_path: str) -> int:
"""Gets the number of XlaCallModule ops in the output saved model."""
root = load.load(output_saved_model_path)
tf_graph_def = root.signatures['serving_default'].graph.as_graph_def()
count = 0
- 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 _create_einsum_model
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_einsum_model(
Function _create_matmul_model
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_matmul_model(
Function _create_matmul_and_same_scale_model
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_matmul_and_same_scale_model(
Function _create_conv2d_model
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _create_conv2d_model(
self,
input_shape: Sequence[int],
filter_shape: Sequence[int],
saved_model_path: str,
- 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 _create_matmul_model
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _create_matmul_model(
self,
input_shape: Sequence[int],
weight_shape: Sequence[int],
saved_model_path: str,
- 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 _extract_first_xla_call_module_op
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _extract_first_xla_call_module_op(
self, output_saved_model_path: str
) -> str:
"""Extracts the first XlaCallModule op from output saved model to string."""
root = load.load(output_saved_model_path)
- 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"