File pooling_ops_test.py
has 2347 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2015 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
PoolingTest
has 112 functions (exceeds 20 allowed). Consider refactoring. Open
class PoolingTest(test.TestCase, parameterized.TestCase):
def _isMaxPool(self, func):
return func in (nn_ops.max_pool, nn_ops.max_pool_v2)
Function _VerifyOneType
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def _VerifyOneType(
self,
pool_func,
input_sizes,
ksize,
- 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 _VerifyOneType
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def _VerifyOneType(
Function _testMaxPoolGradDirect
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def _testMaxPoolGradDirect(self, input_data, output_backprop,
Function GetTestConfigsDicts
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def GetTestConfigsDicts(v1_fn,
v2_fn=None,
one_dimensional=False,
allow_gpu=True):
# (data_format, use_gpu) tuple
- 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 _ConstructAndTestSecondGradient
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def _ConstructAndTestSecondGradient(self,
Function _ConstructAndTestGradient
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def _ConstructAndTestGradient(self,
Function _VerifyValues
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def _VerifyValues(self,
Function _VerifyOneTest
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def _VerifyOneTest(self, pool_func, input_sizes, ksize, strides, padding,
Function _MaxPoolGrad
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def _MaxPoolGrad(self, orig_input, orig_output, grad, window_rows,
Function _ConstructAndTestGradient
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _ConstructAndTestGradient(self,
pool_func,
input_sizes,
output_sizes,
window_rows,
- 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 _MaxPoolGradGrad
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _MaxPoolGradGrad(self, orig_input, orig_output, grad, window_rows,
Function _VerifyOneTest
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _VerifyOneTest(self, pool_func, input_sizes, ksize, strides, padding,
data_format, expected, use_gpu, v2,
use_negative_input=False):
"""Verifies the output values of the pooling function.
- 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 GetTestConfigs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def GetTestConfigs(include_nchw_vect_c=False, one_dimensional=False):
"""Get all the valid tests configs to run.
Args:
include_nchw_vect_c: Whether to include NCHW_VECT_C in the test configs.
- 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 _ConstructAndTestSecondGradient
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _ConstructAndTestSecondGradient(self,
pool_func,
input_sizes,
output_sizes,
window_rows,
- 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 _CompareMaxPoolingGradBk
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _CompareMaxPoolingGradBk(self, input_shape, output_shape, ksize, strides,
Function _CompareMaxPoolingBk
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _CompareMaxPoolingBk(self, input_shape, output_shape, ksize, strides,
Function _testDepthwiseMaxPoolInvalidConfig
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _testDepthwiseMaxPoolInvalidConfig(self,
Function GetMaxPoolGradGradTest
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def GetMaxPoolGradGradTest(input_size, filter_size, output_size, strides,
Function GetMaxPoolGradTest
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def GetMaxPoolGradTest(input_size, filter_size, output_size, strides, padding):
Function _testMaxPoolGradDirectWithNans2_2
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _testMaxPoolGradDirectWithNans2_2(self):
input_data = [float("nan")] * 16
output_backprop = [
float("nan"), 12.0, 13.0, 15.0,
float("nan"), 17.0, 19.0, 20.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 _testMaxPoolGradDirectWithNans2_1
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _testMaxPoolGradDirectWithNans2_1(self):
input_data = [float("nan")] * 16
output_backprop = [11.0, 12.0, 13.0, 15.0, 16.0, 17.0, 19.0, 20.0, 21.0]
# Test the CPU implementation, which propagates diffs in case of NaN
expected_input_backprop_tf_cpu = [
- 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"