Showing 11,634 of 11,634 total issues
Avoid deeply nested control flow statements. Open
Open
if model_options.add_image_level_feature:
if model_options.crop_size is not None:
image_pooling_crop_size = model_options.image_pooling_crop_size
# If image_pooling_crop_size is not specified, use crop_size.
if image_pooling_crop_size is None:
Avoid deeply nested control flow statements. Open
Open
if decoder_stage:
scope_suffix = '_{}'.format(decoder_stage)
for i, name in enumerate(feature_list):
Avoid deeply nested control flow statements. Open
Open
for i in range(num_frames):
frame_id = '%.10d' % i
all_frames.append(dr + ' ' + cam + ' ' + frame_id)
Avoid deeply nested control flow statements. Open
Open
if model_options.atrous_rates:
# Employ 3x3 convolutions with different atrous rates.
for i, rate in enumerate(model_options.atrous_rates, 1):
scope = ASPP_SCOPE + str(i)
if model_options.aspp_with_separable_conv:
Function _convert_dataset
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def _convert_dataset(dataset_split, dataset_dir, dataset_label_dir):
"""Converts the ADE20k dataset into into tfrecord format.
Args:
dataset_split: Dataset split (e.g., train, val).
- 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
Avoid deeply nested control flow statements. Open
Open
if i == j or abs(i - j) != 1:
continue
# In legacy mode, only consider the middle frame as target.
if self.legacy_mode and j != self.middle_frame_index:
Function conv2d
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def conv2d(inputs,
num_outputs,
kernel_size,
stride=1,
padding='SAME',
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, data_dir, batch_size, img_height, img_width, seq_length,
Avoid deeply nested control flow statements. Open
Open
if backbone[cell_num - 1] == 3 and nas_remove_os32_stride:
# No need to rescale features.
pass
else:
# Scale features by a factor of 2.
Avoid deeply nested control flow statements. Open
Open
if self.icp_weight > 0:
cloud_a = self.cloud[j][s]
cloud_b = self.cloud[i][s]
self.icp_transform[s][key], self.icp_residual[s][key] = icp(
cloud_a, egomotion, cloud_b)
Avoid deeply nested control flow statements. Open
Open
for output in outputs_to_num_classes:
scales_to_logits = outputs_to_scales_to_logits[output]
self.assertListEqual(sorted(scales_to_logits.keys()),
sorted(expected_endpoints[i]))
Avoid deeply nested control flow statements. Open
Open
if output_stride is None:
factor = 1
else:
factor = nominal_stride // output_stride
output = resnet_utils.subsample(output, factor)
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self,
Avoid deeply nested control flow statements. Open
Open
if self.legacy_mode:
if egomotion_index >= self.middle_frame_index:
egomotion_mult *= -1
egomotion = egomotion_mult * self.egomotion[:, egomotion_index, :]
Avoid deeply nested control flow statements. Open
Open
for i, name in enumerate(feature_list):
decoder_features_list = [decoder_features]
# MobileNet and NAS variants use different naming convention.
if ('mobilenet' in model_variant or
model_variant.startswith('mnas') or
Avoid deeply nested control flow statements. Open
Open
if output_stride % 4 != 0:
raise ValueError('The output_stride needs to be a multiple of 4.')
output_stride //= 4
Avoid deeply nested control flow statements. Open
Open
if output_stride != 1:
stride = 2
output_stride //= 2
else:
stride = 1
Avoid deeply nested control flow statements. Open
Open
if self.legacy_mode and j != self.middle_frame_index:
continue
source = self.images[s][:, :, :, 3 * i:3 * (i + 1)]
Function _build_metric
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _build_metric(metric,
Function _pnasnet
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _pnasnet(self,