tensorflow/models

View on GitHub

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',
Severity: Major
Found in research/slim/nets/inception_v4.py - About 45 mins to fix

    Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def __init__(self,
    Severity: Minor
    Found in research/cognitive_planning/policies.py - About 45 mins to fix

      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,
      Severity: Major
      Found in research/slim/nets/resnet_v1_test.py - About 45 mins to fix

        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)
        Severity: Major
        Found in research/slim/nets/resnet_v1_test.py - About 45 mins to fix

          Function _visualize_boxes has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def _visualize_boxes(image, boxes, classes, scores, category_index, **kwargs):
          Severity: Minor
          Found in research/cognitive_planning/visualization_utils.py - About 45 mins to fix

            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:
            Severity: Major
            Found in research/slim/nets/resnet_utils.py - About 45 mins to fix

              Function deploy has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def deploy(config,
              Severity: Minor
              Found in research/slim/deployment/model_deploy.py - About 45 mins to fix

                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))
                Severity: Major
                Found in research/slim/deployment/model_deploy.py - About 45 mins to fix

                  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.
                  Severity: Minor
                  Found in research/slim/train_image_classifier.py - About 45 mins to fix

                  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,
                  Severity: Minor
                  Found in research/cognitive_planning/tasks.py - About 45 mins to fix

                    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.
                    Severity: Minor
                    Found in research/cognitive_planning/tasks.py - About 45 mins to fix

                    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'
                    Severity: Major
                    Found in research/cognitive_planning/visualization_utils.py - About 45 mins to fix

                      Function evaluate_checkpoint_repeatedly has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def evaluate_checkpoint_repeatedly(checkpoint_dir,
                      Severity: Minor
                      Found in research/efficient-hrl/utils/eval_utils.py - About 45 mins to fix

                        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,
                        Severity: Minor
                        Found in research/efficient-hrl/utils/eval_utils.py - About 45 mins to fix

                          Function prediction_to_keypoints_argmax has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def prediction_to_keypoints_argmax(
                          Severity: Minor
                          Found in research/object_detection/meta_architectures/center_net_meta_arch.py - About 45 mins to fix

                            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)
                            
                            
                            Severity: Minor
                            Found in research/object_detection/model_main.py - About 45 mins to fix

                            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,
                            Severity: Minor
                            Found in research/efficient-hrl/context/samplers.py - About 45 mins to fix

                              Function env_transition has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              def env_transition(agent, state, action, transition_type, environment_steps,
                              Severity: Minor
                              Found in research/efficient-hrl/cond_fn.py - About 45 mins to fix

                                Function ctrl_rewards has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                def ctrl_rewards(states,
                                Severity: Minor
                                Found in research/efficient-hrl/context/rewards_functions.py - About 45 mins to fix

                                  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)
                                  Severity: Major
                                  Found in research/deep_speech/data/download.py - About 45 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language