tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

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

def _generate_detections_v3(
Severity: Minor
Found in official/vision/modeling/layers/detection_generator.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):
        """Loading pretrained checkpoint."""
        if not self.task_config.init_checkpoint:
          return
    
    
    Severity: Minor
    Found in official/vision/tasks/retinanet.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 test_network_creation has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def test_network_creation(self, input_size, model_id, endpoint_filter_scale,
    Severity: Minor
    Found in official/vision/modeling/backbones/resnet_3d_test.py - About 45 mins to fix

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

        def call(self, inputs, training=None):
          in_filters = inputs.shape.as_list()[-1]
          if in_filters == 4 * self._filters:
            if self._temporal_strides == 1 and self._spatial_strides == 1:
              shortcut = inputs
      Severity: Minor
      Found in official/vision/modeling/layers/nn_blocks_3d.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 _decode_multilevel_outputs has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def _decode_multilevel_outputs(
      Severity: Minor
      Found in official/vision/modeling/layers/detection_generator.py - About 45 mins to fix

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

          def __init__(self,
                       in_filters,
                       out_filters,
                       se_ratio,
                       divisible_by=1,
        Severity: Minor
        Found in official/vision/modeling/layers/nn_layers.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 uib has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def uib(
        Severity: Minor
        Found in official/vision/modeling/backbones/mobilenet.py - About 45 mins to fix

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

            def uib(
          Severity: Minor
          Found in official/vision/modeling/backbones/mobilenet.py - About 45 mins to fix

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

              def uib(
            Severity: Minor
            Found in official/vision/modeling/backbones/mobilenet.py - About 45 mins to fix

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

                def __init__(
                    self,
                    dim,
                    drop_rate=0.0,
                    layer_scale_init_value=1e-6,
              Severity: Minor
              Found in official/vision/modeling/backbones/resnet_unet.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 __call__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def __call__(
              Severity: Minor
              Found in official/vision/modeling/layers/detection_generator.py - About 45 mins to fix

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

                  def uib(
                Severity: Minor
                Found in official/vision/modeling/backbones/mobilenet.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/vision/serving/export_base_v2.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: Union[tf.TensorShape, List[tf.TensorShape]]):
                        """Creates the variables of the mask scoring head."""
                        conv_op = tf_keras.layers.Conv2D
                        conv_kwargs = {
                            'filters': self._config_dict['num_filters'],
                    Severity: Minor
                    Found in official/vision/modeling/heads/segmentation_heads.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: Union[tf.TensorShape, List[tf.TensorShape]]):
                        """Creates the variables of the head."""
                        conv_op = (tf_keras.layers.SeparableConv2D
                                   if self._config_dict['use_separable_conv']
                                   else tf_keras.layers.Conv2D)
                    Severity: Minor
                    Found in official/vision/modeling/heads/instance_heads.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 round_filters has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def round_filters(filters: int,
                    Severity: Minor
                    Found in official/vision/modeling/layers/nn_layers.py - About 45 mins to fix

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

                        def test_network_creation(self, input_size, min_level, max_level,
                      Severity: Minor
                      Found in official/vision/modeling/decoders/fpn_test.py - About 45 mins to fix

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

                          def call(self, features: Mapping[str, tf.Tensor]):
                            """Forward pass of the RetinaNet head.
                        
                            Args:
                              features: A `dict` of `tf.Tensor` where
                        Severity: Minor
                        Found in official/vision/modeling/heads/dense_prediction_heads.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 get_activation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def get_activation(identifier, use_keras_layer=False, **kwargs):
                          """Maps an identifier to a Python function, e.g., "relu" => `tf.nn.relu`.
                        
                          It checks string first and if it is one of customized activation not in TF,
                          the corresponding activation will be returned. For non-customized activation
                        Severity: Minor
                        Found in official/modeling/tf_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 add_encoded_image_feature has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def add_encoded_image_feature(
                              self,
                              encoded_image: bytes,
                              image_format: Optional[str] = None,
                              height: Optional[int] = None,
                        Severity: Minor
                        Found in official/vision/data/tf_example_builder.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

                        Severity
                        Category
                        Status
                        Source
                        Language