tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

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

  def test_metric_computation_is_correct(
Severity: Minor
Found in official/recommendation/uplift/metrics/poisson_metrics_test.py - About 45 mins to fix

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

      def __init__(
          self,
          config: ExperimentConfig,
          task: base_task.Task,
          model: tf_keras.Model,
    Severity: Minor
    Found in official/core/base_trainer.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 _postprocess_image has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def _postprocess_image(image: tf.Tensor,
    Severity: Minor
    Found in official/projects/video_ssl/dataloaders/video_ssl_input.py - About 45 mins to fix

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

      def contrastive_loss(hidden,
      Severity: Minor
      Found in official/projects/video_ssl/losses/losses.py - About 45 mins to fix

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

          def assertHasSameTypes(self, c, d, msg=''):
            """Checks if a Config has the same structure as a given dict.
        
            Args:
              c: the Config object to be check.
        Severity: Minor
        Found in official/modeling/hyperparams/base_config_test.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 official/core/export_base.py - About 45 mins to fix

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

            def initialize(self, model: tf_keras.Model):
              """Loads pretrained checkpoint."""
              if not self.task_config.init_checkpoint:
                return
          
          
          Severity: Minor
          Found in official/projects/mosaic/mosaic_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

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

              def apply_transform(i, x, brightness, contrast, saturation, hue):
          Severity: Minor
          Found in official/projects/video_ssl/ops/video_ssl_preprocess_ops.py - About 45 mins to fix

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

              def __init__(self,
            Severity: Minor
            Found in official/modeling/optimization/lr_schedule.py - About 45 mins to fix

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

                def build(
                    self,
                    input_shape: Tuple[tf.TensorShape, tf.TensorShape]) -> None:
                  """Builds this block with the given input shape."""
                  # Assume backbone features of the same level are concated before input.
              Severity: Minor
              Found in official/projects/mosaic/modeling/mosaic_blocks.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 k in nodes_below:
                            logging.info(streams[k].shape)
                            lg_channel = max(streams[k].shape[3], lg_channel)
              
              
              Severity: Major
              Found in official/projects/assemblenet/modeling/assemblenet_plus.py - About 45 mins to fix

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

                  def _import_config(cls, v, subconfig_type):
                    """Returns v with dicts converted to Configs, recursively."""
                    if not issubclass(subconfig_type, params_dict.ParamsDict):
                      raise TypeError(
                          'Subconfig_type should be subclass of ParamsDict, found {!r}'.format(
                Severity: Minor
                Found in official/modeling/hyperparams/base_config.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 build has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def build(self, input_shape: tf.TensorShape) -> None:
                    """Builds the block with the given input shape."""
                    input_channels = input_shape[self._group_split_axis]
                    if input_channels % self._num_groups != 0:
                      raise ValueError('The number of input channels must be divisible by '
                Severity: Minor
                Found in official/projects/mosaic/qat/modeling/layers/nn_blocks.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 conv3d_same_padding has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def conv3d_same_padding(inputs: tf.Tensor,
                Severity: Minor
                Found in official/projects/assemblenet/modeling/assemblenet.py - About 45 mins to fix

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

                  def create_trainer(params: config_definitions.ExperimentConfig,
                  Severity: Minor
                  Found in official/core/train_utils.py - About 45 mins to fix

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

                      def __init__(self,
                    Severity: Minor
                    Found in official/projects/assemblenet/modeling/assemblenet_plus.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                  for node_index in nodes_below:
                                    attn = tf.reduce_mean(streams[node_index], [1, 2])
                      
                                    attn = tf_keras.layers.Dense(
                                        units=lg_channel,
                      Severity: Major
                      Found in official/projects/assemblenet/modeling/assemblenet_plus.py - About 45 mins to fix

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

                        def try_count_params(
                            model: Union[tf.Module, tf_keras.Model],
                            trainable_only: bool = False):
                          """Count the number of parameters if model is possible.
                        
                        
                        Severity: Minor
                        Found in official/core/train_utils.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 _maybe_build_checkpoint_manager has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def _maybe_build_checkpoint_manager(
                              self) -> Optional[tf.train.CheckpointManager]:
                            """Maybe create a CheckpointManager."""
                            assert self.trainer is not None
                            if self.trainer.checkpoint:
                        Severity: Minor
                        Found in official/core/train_lib.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__(
                        Severity: Minor
                        Found in official/projects/maskconver/modeling/layers/maskconver_head.py - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language