tensorflow/models

View on GitHub
official/nlp/modeling/layers/kernel_attention_test.py

Summary

Maintainability
F
3 days
Test Coverage

Function test_causal_windowed_attention_projection has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def test_causal_windowed_attention_projection(
Severity: Major
Found in official/nlp/modeling/layers/kernel_attention_test.py - About 50 mins to fix

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

      def test_attention_projection(
    Severity: Minor
    Found in official/nlp/modeling/layers/kernel_attention_test.py - About 45 mins to fix

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

        def test_attention_no_projection(
      Severity: Minor
      Found in official/nlp/modeling/layers/kernel_attention_test.py - About 45 mins to fix

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

          @parameterized.parameters(
              itertools.product(_FEATURE_TRANSFORM, [127], _TRAINING, [True, False],
                                _IS_SHORT_SEQ, _BEGIN_KERNEL))
          def test_attention_projection(
              self, feature_transform, num_random_features, training, redraw, is_short,
        Severity: Major
        Found in official/nlp/modeling/layers/kernel_attention_test.py and 1 other location - About 1 day to fix
        official/nlp/modeling/layers/kernel_attention_test.py on lines 156..184

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 149.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

          @parameterized.parameters(itertools.product(
              _FEATURE_TRANSFORM, [0], _TRAINING, [False],
              _IS_SHORT_SEQ, _BEGIN_KERNEL))
          def test_attention_no_projection(
              self, feature_transform, num_random_features, training, redraw, is_short,
        Severity: Major
        Found in official/nlp/modeling/layers/kernel_attention_test.py and 1 other location - About 1 day to fix
        official/nlp/modeling/layers/kernel_attention_test.py on lines 91..119

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 149.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            test_layer = attention.KernelAttention(
        Severity: Major
        Found in official/nlp/modeling/layers/kernel_attention_test.py and 1 other location - About 1 hr to fix
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 235..235

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            self.assertAllClose(
                tf.tile(
                    tf.reshape([1., 2., 3., 3., 3.], [1, -1, 1, 1, 1]),
                    [2, 1, 2, 2, 2]),
                winsum)
        Severity: Major
        Found in official/nlp/modeling/layers/kernel_attention_test.py and 1 other location - About 1 hr to fix
        official/nlp/modeling/layers/kernel_attention_test.py on lines 251..255

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 42.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            self.assertAllClose(
                tf.tile(
                    tf.reshape([1., 1.1, 1.11, 1.11, 1.11], [1, -1, 1, 1, 1]),
                    [2, 1, 2, 2, 2]),
                winsum)
        Severity: Major
        Found in official/nlp/modeling/layers/kernel_attention_test.py and 1 other location - About 1 hr to fix
        official/nlp/modeling/layers/kernel_attention_test.py on lines 241..245

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 42.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                  test_layer(
                      query=query[:, i * causal_chunk_length:(i + 1) *
        Severity: Minor
        Found in official/nlp/modeling/layers/kernel_attention_test.py and 1 other location - About 35 mins to fix
        official/nlp/modeling/layers/kernel_attention_test.py on lines 79..82

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 33.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        There are no issues that match your filters.

        Category
        Status