Showing 11,634 of 11,634 total issues
Avoid deeply nested control flow statements. Open
with tf.variable_scope('AuxLogits'):
# 17 x 17 x 1024
aux_logits = end_points['Mixed_6h']
aux_logits = slim.avg_pool2d(aux_logits, [5, 5], stride=3,
padding='VALID',
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Avoid deeply nested control flow statements. Open
with self.test_session() as sess:
tf.set_random_seed(0)
inputs = create_test_input(1, height, width, 3)
# Dense feature extraction followed by subsampling.
output = resnet_utils.stack_blocks_dense(inputs,
Avoid deeply nested control flow statements. Open
if output_stride is None:
factor = 1
else:
factor = nominal_stride // output_stride
output = resnet_utils.subsample(output, factor)
Function _visualize_boxes
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _visualize_boxes(image, boxes, classes, scores, category_index, **kwargs):
Avoid deeply nested control flow statements. Open
if output_stride is not None and current_stride == output_stride:
net = block.unit_fn(net, rate=rate, **dict(unit, stride=1))
rate *= unit.get('stride', 1)
else:
Function deploy
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def deploy(config,
Avoid deeply nested control flow statements. Open
with tf.variable_scope(tf.get_variable_scope(),
reuse=True if i > 0 else None):
outputs = model_fn(*args, **kwargs)
clones.append(Clone(outputs, clone_scope, clone_device))
Function _configure_optimizer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _configure_optimizer(learning_rate):
"""Configures the optimizer used for training.
Args:
learning_rate: A scalar or `Tensor` learning rate.
- 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 _sample_obs
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _sample_obs(self,
Function tf_episode_batch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def tf_episode_batch(self, batch_size):
"""A batch of episodes as TF Tensors.
Same as episode_batch with the difference that the return values are TF
Tensors.
- 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
if not agnostic_mode:
if classes[i] in category_index.keys():
class_name = category_index[classes[i]]['name']
else:
class_name = 'N/A'
Function evaluate_checkpoint_repeatedly
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def evaluate_checkpoint_repeatedly(checkpoint_dir,
Function compute_average_reward
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def compute_average_reward(sess, env_base, step_fn, gamma, num_steps,
Function prediction_to_keypoints_argmax
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def prediction_to_keypoints_argmax(
Function main
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def main(unused_argv):
flags.mark_flag_as_required('model_dir')
flags.mark_flag_as_required('pipeline_config_path')
config = tf_estimator.RunConfig(model_dir=FLAGS.model_dir)
- 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
def __init__(self,
Function env_transition
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def env_transition(agent, state, action, transition_type, environment_steps,
Function ctrl_rewards
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def ctrl_rewards(states,
Avoid deeply nested control flow statements. Open
if not tf.io.gfile.exists(wav_file):
tfm.build(flac_file, wav_file)
wav_filesize = os.path.getsize(wav_file)