tensorflow/tensorflow

View on GitHub
tensorflow/python/distribute/values_test.py

Summary

Maintainability
F
1 wk
Test Coverage

File values_test.py has 595 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2018 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 tensorflow/python/distribute/values_test.py - About 1 day to fix

    DistributedVariableTest has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class DistributedVariableTest(test.TestCase, parameterized.TestCase):
    
      def tearDown(self):
        super().tearDown()
        context._reset_context()
    Severity: Minor
    Found in tensorflow/python/distribute/values_test.py - About 2 hrs to fix

      Function testOperatorOverride has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def testOperatorOverride(self):
          v = values_lib.DistributedDelegate((7, 8))
          # v should act like int(7).
          self.assertEqual(8, v + 1)
          self.assertEqual(10, 3 + v)
      Severity: Minor
      Found in tensorflow/python/distribute/values_test.py - About 1 hr to fix

        Function _make_replica_local has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def _make_replica_local(method, strategy=None):
          if strategy is None:
            devices = ("/device:GPU:0", "/device:CPU:0")
          else:
            devices = strategy.extended.worker_devices
        Severity: Minor
        Found in tensorflow/python/distribute/values_test.py - About 25 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

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

          def _restore_replica_local_sum(self, save_path, distribution):
            """Restore to variables with mirroring in a fresh graph."""
            with self.session(graph=ops.Graph()) as sess:
              v, replica_local = _make_replica_local(
                  variable_scope.VariableAggregation.SUM, distribution)
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 1 day to fix
        tensorflow/python/distribute/values_test.py on lines 717..730

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

        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 _restore_replica_local_mean(self, save_path, distribution):
            """Restore to variables with mirroring in a fresh graph."""
            with self.session(graph=ops.Graph()) as sess:
              v, replica_local = _make_replica_local(
                  variable_scope.VariableAggregation.MEAN, distribution)
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 1 day to fix
        tensorflow/python/distribute/values_test.py on lines 732..745

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

        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

          @combinations.generate(mirrored_and_tpu_strategy_combinations())
          def testSaveAndRestoreReplicaLocalSumOneGraph(self, distribution):
            with self.cached_session() as sess:
              v, replica_local = _make_replica_local(
                  variable_scope.VariableAggregation.SUM, distribution)
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 7 hrs to fix
        tensorflow/python/distribute/values_test.py on lines 635..651

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

        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

            with self.cached_session() as sess:
              v, replica_local = _make_replica_local(
                  variable_scope.VariableAggregation.MEAN, distribution)
        
              # Overwrite the initial values.
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 7 hrs to fix
        tensorflow/python/distribute/values_test.py on lines 609..628

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

        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 _restore_normal(self, save_path):
            """Restore to variables without mirroring in a fresh graph."""
            with self.session(graph=ops.Graph()) as sess:
              var = variable_scope.get_variable(
                  name="v", initializer=7., use_resource=True)
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 6 hrs to fix
        tensorflow/python/distribute/mirrored_values_test.py on lines 158..170

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

        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 _save_replica_local_sum(self, distribution):
            """Save variables with mirroring, returns save_path."""
            with self.session(graph=ops.Graph()) as sess:
              v, replica_local = _make_replica_local(
                  variable_scope.VariableAggregation.SUM, distribution)
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 5 hrs to fix
        tensorflow/python/distribute/values_test.py on lines 653..668

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

        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 _save_replica_local_mean(self, distribution):
            """Save variables with mirroring, returns save_path."""
            with self.session(graph=ops.Graph()) as sess:
              v, replica_local = _make_replica_local(
                  variable_scope.VariableAggregation.MEAN, distribution)
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 5 hrs to fix
        tensorflow/python/distribute/values_test.py on lines 670..685

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

        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 _save_normal(self):
            """Save variables without mirroring, returns save_path."""
            with self.session(graph=ops.Graph()) as sess:
              var = variable_scope.get_variable(
                  name="v", initializer=1., use_resource=True)
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 5 hrs to fix
        tensorflow/python/distribute/mirrored_values_test.py on lines 142..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 91.

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

        def _nested_value(d):
          return ("a" + d, ["b" + d, {"c": "d" + d, "e": "f" + d}, "g" + d], "h" + d)
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 2 other locations - About 2 hrs to fix
        tensorflow/python/distribute/distribute_utils_test.py on lines 32..33
        tensorflow/python/distribute/distributed_variable_test.py on lines 58..59

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

        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 _save_return_saver(self, sess, var):
            saver = saver_lib.Saver(var_list=[var])
            test_dir = self.get_temp_dir()
            prefix = os.path.join(test_dir, "ckpt")
            return saver.save(sess, prefix), saver
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 2 hrs to fix
        tensorflow/python/distribute/mirrored_values_test.py on lines 117..121

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

        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

          for d, n, init in zip(devices, ["v", "v/replica"], [1., 2.]):
            with ops.device(d):
              v.append(variable_scope.get_variable(
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 2 hrs to fix
        tensorflow/python/distribute/mirrored_values_test.py on lines 44..47

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

        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

          @combinations.generate(
              combinations.combine(
                  distribution=[
                      strategy_combinations.mirrored_strategy_with_gpu_and_cpu,
                      strategy_combinations
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 1 hr to fix
        tensorflow/python/distribute/values_test.py on lines 287..297

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

        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

          @combinations.generate(
              combinations.combine(
                  distribution=[
                      strategy_combinations.mirrored_strategy_with_gpu_and_cpu,
                      strategy_combinations
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 1 hr to fix
        tensorflow/python/distribute/values_test.py on lines 231..241

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

        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

          @combinations.generate(mirrored_and_tpu_strategy_combinations())
          def testSaveReplicaLocalRestoreReplicaLocalMean(self, distribution):
            save_path = self._save_replica_local_mean(distribution)
            self._restore_replica_local_mean(save_path, distribution)
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 1 hr to fix
        tensorflow/python/distribute/values_test.py on lines 752..755

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

        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

          @combinations.generate(mirrored_and_tpu_strategy_combinations())
          def testSaveReplicaLocalRestoreReplicaLocalSum(self, distribution):
            save_path = self._save_replica_local_sum(distribution)
            self._restore_replica_local_sum(save_path, distribution)
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 1 hr to fix
        tensorflow/python/distribute/values_test.py on lines 747..750

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

        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

          @combinations.generate(mirrored_and_tpu_strategy_combinations())
          def testSaveReplicaLocalSumRestoreNormal(self, distribution):
            save_path = self._save_replica_local_sum(distribution)
            self._restore_normal(save_path)
        Severity: Minor
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 55 mins to fix
        tensorflow/python/distribute/values_test.py on lines 757..760

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

        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

          @combinations.generate(mirrored_and_tpu_strategy_combinations())
          def testSaveReplicaLocalMeanRestoreNormal(self, distribution):
            save_path = self._save_replica_local_mean(distribution)
            self._restore_normal(save_path)
        Severity: Minor
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 55 mins to fix
        tensorflow/python/distribute/values_test.py on lines 762..765

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

        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

          @combinations.generate(mirrored_and_tpu_strategy_combinations())
          def testSaveNormalRestoreReplicaLocalSum(self, distribution):
            save_path = self._save_normal()
            self._restore_replica_local_sum(save_path, distribution)
        Severity: Minor
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 50 mins to fix
        tensorflow/python/distribute/values_test.py on lines 767..770

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

        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

          @combinations.generate(mirrored_and_tpu_strategy_combinations())
          def testSaveNormalRestoreReplicaLocalMean(self, distribution):
            save_path = self._save_normal()
            self._restore_replica_local_mean(save_path, distribution)
        Severity: Minor
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 50 mins to fix
        tensorflow/python/distribute/values_test.py on lines 772..775

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

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

            with distribution.scope():
              v1 = variables_lib.Variable(
                  0.0,
                  aggregation=variables_lib.VariableAggregation.NONE,
                  synchronization=variables_lib.VariableSynchronization.ON_WRITE)
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 7 other locations - About 40 mins to fix
        tensorflow/python/distribute/strategy_common_test.py on lines 418..422
        tensorflow/python/distribute/values_test.py on lines 492..496
        tensorflow/python/distribute/vars_test.py on lines 346..350
        tensorflow/python/distribute/vars_test.py on lines 911..915
        tensorflow/python/distribute/vars_test.py on lines 924..928
        tensorflow/python/distribute/vars_test.py on lines 1006..1010
        tensorflow/python/distribute/vars_test.py on lines 1063..1067

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

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

            with distribution.scope():
              v = variables_lib.Variable(
                  1.,
                  aggregation=variables_lib.VariableAggregation.MEAN,
                  synchronization=variables_lib.VariableSynchronization.ON_READ)
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 7 other locations - About 40 mins to fix
        tensorflow/python/distribute/strategy_common_test.py on lines 418..422
        tensorflow/python/distribute/values_test.py on lines 563..567
        tensorflow/python/distribute/vars_test.py on lines 346..350
        tensorflow/python/distribute/vars_test.py on lines 911..915
        tensorflow/python/distribute/vars_test.py on lines 924..928
        tensorflow/python/distribute/vars_test.py on lines 1006..1010
        tensorflow/python/distribute/vars_test.py on lines 1063..1067

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

        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

          @combinations.generate(combinations.combine(
              distribution=[
                  strategy_combinations.mirrored_strategy_with_gpu_and_cpu,
                  strategy_combinations.mirrored_strategy_with_two_gpus_no_merge_call,
                  strategy_combinations.tpu_strategy,
        Severity: Minor
        Found in tensorflow/python/distribute/values_test.py and 1 other location - About 35 mins to fix
        tensorflow/python/distribute/collective_all_reduce_strategy_test.py on lines 700..708

        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

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

            if context.num_gpus() < 1 and context.executing_eagerly():
              self.skipTest("A GPU is not available for this test in eager mode.")
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 5 other locations - About 30 mins to fix
        tensorflow/python/distribute/mirrored_values_test.py on lines 90..91
        tensorflow/python/distribute/mirrored_values_test.py on lines 207..213
        tensorflow/python/distribute/mirrored_values_test.py on lines 220..226
        tensorflow/python/distribute/mirrored_values_test.py on lines 233..239
        tensorflow/python/distribute/values_test.py on lines 468..469

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

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

            if context.num_gpus() < 1 and context.executing_eagerly():
              self.skipTest("A GPU is not available for this test in eager mode.")
        Severity: Major
        Found in tensorflow/python/distribute/values_test.py and 5 other locations - About 30 mins to fix
        tensorflow/python/distribute/mirrored_values_test.py on lines 90..91
        tensorflow/python/distribute/mirrored_values_test.py on lines 207..213
        tensorflow/python/distribute/mirrored_values_test.py on lines 220..226
        tensorflow/python/distribute/mirrored_values_test.py on lines 233..239
        tensorflow/python/distribute/values_test.py on lines 632..633

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

        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