tensorflow/models

View on GitHub
research/slim/nets/resnet_v1_test.py

Summary

Maintainability
F
1 mo
Test Coverage

File resnet_v1_test.py has 528 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Severity: Major
Found in research/slim/nets/resnet_v1_test.py - About 1 day to fix

    Function _resnet_small has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def _resnet_small(self,
    Severity: Major
    Found in research/slim/nets/resnet_v1_test.py - About 1 hr to fix

      Function testEndpointNames has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def testEndpointNames(self):
          # Like ResnetUtilsTest.testEndPointsV1(), but for the public API.
          global_pool = True
          num_classes = 10
          inputs = create_test_input(2, 224, 224, 3)
      Severity: Minor
      Found in research/slim/nets/resnet_v1_test.py - About 55 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 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

        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)
        
                      # Subsampling at the last unit of the block.
        Severity: Major
        Found in research/slim/nets/resnet_v1_test.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

            Function testStridingLastUnitVsSubsampleBlockEnd has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def testStridingLastUnitVsSubsampleBlockEnd(self):
                """Compares subsampling at the block's last unit or block's end.
            
                Makes sure that the final output is the same when we use a stride at the
                last unit of a block vs. we subsample activations at the end of a block.
            Severity: Minor
            Found in research/slim/nets/resnet_v1_test.py - About 35 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

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

              def testConv2DSameEven(self):
                n, n2 = 4, 2
            
                # Input image.
                x = create_test_input(1, n, n, 1)
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 1 other location - About 4 days to fix
            research/slim/nets/resnet_v2_test.py on lines 73..109

            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 426.

            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

              def testConv2DSameOdd(self):
                n, n2 = 5, 3
            
                # Input image.
                x = create_test_input(1, n, n, 1)
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 1 other location - About 3 days to fix
            research/slim/nets/resnet_v2_test.py on lines 111..148

            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 406.

            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

              def testAtrousValuesBottleneck(self):
                """Verify the values of dense feature extraction by atrous convolution.
            
                Make sure that dense feature extraction by stack_blocks_dense() followed by
                subsampling gives identical results to feature extraction at the nominal
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 1 other location - About 2 days to fix
            research/slim/nets/resnet_v2_test.py on lines 195..237

            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 306.

            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 5 locations. Consider refactoring.
            Open

              def testAtrousFullyConvolutionalValues(self):
                """Verify dense feature extraction with atrous convolution."""
                nominal_stride = 32
                for output_stride in [4, 8, 16, 32, None]:
                  with slim.arg_scope(resnet_utils.resnet_arg_scope()):
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 4 other locations - About 2 days to fix
            research/deeplab/core/resnet_v1_beta_test.py on lines 228..258
            research/deeplab/core/resnet_v1_beta_test.py on lines 475..503
            research/deeplab/core/xception_test.py on lines 362..392
            research/slim/nets/resnet_v2_test.py on lines 385..411

            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 218.

            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

              def testEndpointNames(self):
                # Like ResnetUtilsTest.testEndPointsV1(), but for the public API.
                global_pool = True
                num_classes = 10
                inputs = create_test_input(2, 224, 224, 3)
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 1 other location - About 1 day to fix
            research/slim/nets/resnet_v2_test.py on lines 288..308

            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 211.

            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

              def testClassificationEndPoints(self):
                global_pool = True
                num_classes = 10
                inputs = create_test_input(2, 224, 224, 3)
                with slim.arg_scope(resnet_utils.resnet_arg_scope()):
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 1 other location - About 1 day to fix
            research/slim/nets/resnet_v2_test.py on lines 270..286

            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 197.

            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

              def testUnknownBatchSize(self):
                batch = 2
                height, width = 65, 65
                global_pool = True
                num_classes = 10
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 1 other location - About 1 day to fix
            research/slim/nets/resnet_v2_test.py on lines 414..432

            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 197.

            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 5 locations. Consider refactoring.
            Open

              def testAtrousFullyConvolutionalUnknownHeightWidth(self):
                batch = 2
                height, width = 65, 65
                global_pool = False
                output_stride = 8
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 4 other locations - About 1 day to fix
            research/deeplab/core/resnet_v1_beta_test.py on lines 300..318
            research/deeplab/core/resnet_v1_beta_test.py on lines 543..560
            research/deeplab/core/xception_test.py on lines 434..452
            research/slim/nets/resnet_v2_test.py on lines 450..467

            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 175.

            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 5 locations. Consider refactoring.
            Open

              def testFullyConvolutionalUnknownHeightWidth(self):
                batch = 2
                height, width = 65, 65
                global_pool = False
                inputs = create_test_input(batch, None, None, 3)
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 4 other locations - About 1 day to fix
            research/deeplab/core/resnet_v1_beta_test.py on lines 282..298
            research/deeplab/core/resnet_v1_beta_test.py on lines 526..541
            research/deeplab/core/xception_test.py on lines 416..432
            research/slim/nets/resnet_v2_test.py on lines 434..448

            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 167.

            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

              def testAtrousFullyConvolutionalEndpointShapes(self):
                global_pool = False
                num_classes = 10
                output_stride = 8
                inputs = create_test_input(2, 321, 321, 3)
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 1 other location - About 1 day to fix
            research/slim/nets/resnet_v2_test.py on lines 364..383

            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 151.

            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

              def testRootlessFullyConvolutionalEndpointShapes(self):
                global_pool = False
                num_classes = 10
                inputs = create_test_input(2, 128, 128, 3)
                with slim.arg_scope(resnet_utils.resnet_arg_scope()):
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 1 other location - About 1 day to fix
            research/slim/nets/resnet_v2_test.py on lines 345..362

            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 146.

            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

              def testFullyConvolutionalEndpointShapes(self):
                global_pool = False
                num_classes = 10
                inputs = create_test_input(2, 321, 321, 3)
                with slim.arg_scope(resnet_utils.resnet_arg_scope()):
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 1 other location - About 1 day to fix
            research/slim/nets/resnet_v2_test.py on lines 327..343

            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 143.

            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

              def testClassificationShapes(self):
                global_pool = True
                num_classes = 10
                inputs = create_test_input(2, 224, 224, 3)
                with slim.arg_scope(resnet_utils.resnet_arg_scope()):
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 1 other location - About 1 day to fix
            research/slim/nets/resnet_v2_test.py on lines 310..325

            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 140.

            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

              def _resnet_small(self,
                                inputs,
                                num_classes=None,
                                is_training=True,
                                global_pool=True,
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 1 other location - About 1 day to fix
            research/slim/nets/resnet_v2_test.py on lines 243..261

            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 133.

            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

              def testEndPointsV1(self):
                """Test the end points of a tiny v1 bottleneck network."""
                blocks = [
                    resnet_v1.resnet_v1_block(
                        'block1', base_depth=1, num_units=2, stride=2),
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 1 other location - About 1 day to fix
            research/slim/nets/resnet_v2_test.py on lines 158..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 128.

            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

            def create_test_input(batch_size, height, width, channels):
              """Create test input tensor.
            
              Args:
                batch_size: The number of images per batch or `None` if unknown.
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 1 other location - About 1 day to fix
            research/slim/nets/resnet_v2_test.py on lines 31..54

            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 122.

            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 4 locations. Consider refactoring.
            Open

              def testSubsampleThreeByThree(self):
                x = tf.reshape(tf.cast(tf.range(9), dtype=tf.float32), [1, 3, 3, 1])
                x = resnet_utils.subsample(x, 2)
                expected = tf.reshape(tf.constant([0, 2, 6, 8]), [1, 2, 2, 1])
                with self.test_session():
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 3 other locations - About 6 hrs to fix
            research/slim/nets/resnet_v1_test.py on lines 66..71
            research/slim/nets/resnet_v2_test.py on lines 59..64
            research/slim/nets/resnet_v2_test.py on lines 66..71

            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 107.

            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 4 locations. Consider refactoring.
            Open

              def testSubsampleFourByFour(self):
                x = tf.reshape(tf.cast(tf.range(16), dtype=tf.float32), [1, 4, 4, 1])
                x = resnet_utils.subsample(x, 2)
                expected = tf.reshape(tf.constant([0, 2, 8, 10]), [1, 2, 2, 1])
                with self.test_session():
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 3 other locations - About 6 hrs to fix
            research/slim/nets/resnet_v1_test.py on lines 59..64
            research/slim/nets/resnet_v2_test.py on lines 59..64
            research/slim/nets/resnet_v2_test.py on lines 66..71

            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 107.

            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

              def _stack_blocks_nondense(self, net, blocks):
                """A simplified ResNet Block stacker without output stride control."""
                for block in blocks:
                  with tf.variable_scope(block.scope, 'block', [net]):
                    for i, unit in enumerate(block.args):
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 1 other location - About 5 hrs to fix
            research/slim/nets/resnet_v2_test.py on lines 186..193

            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 96.

            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

              def _resnet_plain(self, inputs, blocks, output_stride=None, scope=None):
                """A plain ResNet without extra layers before or after the ResNet blocks."""
                with tf.variable_scope(scope, values=[inputs]):
                  with slim.arg_scope([slim.conv2d], outputs_collections='end_points'):
                    net = resnet_utils.stack_blocks_dense(inputs, blocks, output_stride)
            Severity: Major
            Found in research/slim/nets/resnet_v1_test.py and 1 other location - About 4 hrs to fix
            research/slim/nets/resnet_v2_test.py on lines 150..156

            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 82.

            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