tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

Avoid deeply nested control flow statements.
Open

            for tensor in tensor_dict.values():
              self.assertAllEqual(tensor, np.arange(1, 13).reshape((4, 3)) * i)
              i += 1
        with self.assertRaises(tf.errors.OutOfRangeError):
Severity: Major
Found in research/object_detection/core/batcher_tf1_test.py - About 45 mins to fix

    Function sample_episodes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def sample_episodes(self, sess, greedy=False):
        """Sample steps from the environment until we have enough for a batch."""
    
        # check if last batch ended with episode that was not terminated
        if self.unify_episodes:
    Severity: Minor
    Found in research/pcl_rl/controller.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 global_step.value() - logged_step >= LOG_EVERY:
                logged_dict_np = {name: value.numpy() for name, value in
                                  logged_dict.items()}
                tf.logging.info(
                    'Step {} per-step time {:.3f}s'.format(
    Severity: Major
    Found in research/object_detection/model_lib_v2.py - About 45 mins to fix

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

        def setup(self, var_list, values, targets, pads,
      Severity: Minor
      Found in research/pcl_rl/optimizers.py - About 45 mins to fix

        Function sample_actions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def sample_actions(self, output, actions=None, greedy=False):
            """Sample all actions given output of core network."""
            sampled_actions = []
            logits = []
            log_probs = []
        Severity: Minor
        Found in research/pcl_rl/policy.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 setup has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def setup(self, var_list, values, targets, pads,
        Severity: Minor
        Found in research/pcl_rl/optimizers.py - About 45 mins to fix

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

          def to_absolute_coordinates(boxlist,
          Severity: Minor
          Found in research/object_detection/core/box_list_ops.py - About 45 mins to fix

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

                def graph_fn(anchor_means, groundtruth_boxlist1, groundtruth_boxlist2,
            Severity: Minor
            Found in research/object_detection/core/target_assigner_test.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          for _ in tf.range(num_steps_per_iteration - 1):
                            # Following suggestion on yaqs/5402607292645376
                            with tf.name_scope(''):
                              _sample_and_train(strategy, train_step_fn, data_iterator)
              
              
              Severity: Major
              Found in research/object_detection/model_lib_v2.py - About 45 mins to fix

                Function convert_action_to_gym has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def convert_action_to_gym(self, action):
                    if len(action) == 1:
                      return action[0]
                    else:
                      return list(action)
                Severity: Minor
                Found in research/pcl_rl/env_spec.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 multi_step has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def multi_step(self, all_obs, initial_state, all_actions):
                    """Calculate log-probs and other calculations on batch of episodes."""
                    batch_size = tf.shape(initial_state)[0]
                    time_length = tf.shape(all_obs[0])[0]
                
                
                Severity: Minor
                Found in research/pcl_rl/policy.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 convert_from_batched_episodes has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def convert_from_batched_episodes(
                Severity: Minor
                Found in research/pcl_rl/controller.py - About 45 mins to fix

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

                    def add_to_replay_buffer(self, initial_state,
                  Severity: Minor
                  Found in research/pcl_rl/controller.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                for tensor in tensor_dict.values():
                                  self.assertAllEqual(tensor, np.tile(np.arange(4), (i, 1)))
                                  i += 1
                            with self.assertRaises(tf.errors.OutOfRangeError):
                    Severity: Major
                    Found in research/object_detection/core/batcher_tf1_test.py - About 45 mins to fix

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

                      def eager_eval_loop(
                      Severity: Minor
                      Found in research/object_detection/model_lib_v2.py - About 45 mins to fix

                        Function reshape_batched_inputs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def reshape_batched_inputs(self, all_obs, all_actions,
                                                     internal_policy_states, policy_logits):
                            """Reshape inputs from [time_length, batch_size, ...] to
                            [time_length * batch_size, ...].
                        
                        
                        Severity: Minor
                        Found in research/pcl_rl/baseline.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

                                    for tensor in tensor_dict.values():
                                      self.assertAllEqual(tensor, np.arange(i * i).reshape((i, i)))
                                      i += 1
                                with self.assertRaises(tf.errors.OutOfRangeError):
                        Severity: Major
                        Found in research/object_detection/core/batcher_tf1_test.py - About 45 mins to fix

                          Function optimize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def optimize(self, sess, feed_dict):
                              old_theta = sess.run(self.flat_vars)
                              loss_flat_grad = sess.run(self.loss_flat_gradient,
                                                        feed_dict=feed_dict)
                          
                          
                          Severity: Minor
                          Found in research/pcl_rl/trust_region.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 setup has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            def setup(self, var_list, values, targets, pads,
                          Severity: Minor
                          Found in research/pcl_rl/optimizers.py - About 45 mins to fix

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

                            def boolean_mask(boxlist, indicator, fields=None, scope=None,
                            Severity: Minor
                            Found in research/object_detection/core/box_list_ops.py - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language