tensorflow/tensorflow

View on GitHub
tensorflow/python/ops/init_ops_v2_test.py

Summary

Maintainability
F
2 wks
Test Coverage

File init_ops_v2_test.py has 477 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: Minor
Found in tensorflow/python/ops/init_ops_v2_test.py - About 7 hrs to fix

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

      def _range_test(self,
    Severity: Minor
    Found in tensorflow/python/ops/init_ops_v2_test.py - About 45 mins to fix

      Function _identical_test has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def _identical_test(self,
      Severity: Minor
      Found in tensorflow/python/ops/init_ops_v2_test.py - About 35 mins to fix

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

          def _range_test(self,
                          init,
                          shape,
                          target_mean=None,
                          target_std=None,
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 1 other location - About 1 day to fix
        tensorflow/python/ops/init_ops_test.py on lines 34..51

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

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

          @test_util.run_in_graph_and_eager_modes
          def testTruncatedNormalDistribution(self):
            shape = [100, 100]
            expect_mean = 0.
            expect_var = 1. / shape[0]
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 2 other locations - About 1 day to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 324..338
        tensorflow/python/ops/init_ops_v2_test.py on lines 340..354

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

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

          @test_util.run_in_graph_and_eager_modes
          def testNormalDistribution(self):
            shape = [100, 100]
            expect_mean = 0.
            expect_var = 1. / shape[0]
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 2 other locations - About 1 day to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 308..322
        tensorflow/python/ops/init_ops_v2_test.py on lines 340..354

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

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

          @test_util.run_in_graph_and_eager_modes
          def testUntruncatedNormalDistribution(self):
            shape = [100, 100]
            expect_mean = 0.
            expect_var = 1. / shape[0]
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 2 other locations - About 1 day to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 308..322
        tensorflow/python/ops/init_ops_v2_test.py on lines 324..338

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

        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

                if t.shape[0] > t.shape[1]:
                  self.assertAllClose(
                      np.dot(t.T, t), np.eye(t.shape[1]), rtol=tol, atol=tol)
                else:
                  self.assertAllClose(
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 1 other location - About 6 hrs to fix
        tensorflow/python/kernel_tests/array_ops/init_ops_test.py on lines 831..836

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

          @test_util.run_in_graph_and_eager_modes
          def testGlorotUniform(self):
            shape = (5, 6, 4, 2)
            fan_in, fan_out = init_ops_v2._compute_fans(shape)
            std = np.sqrt(2. / (fan_in + fan_out))
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 1 other location - About 4 hrs to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 536..543

        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

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

          @test_util.run_in_graph_and_eager_modes
          def test_GlorotNormal(self):
            shape = (5, 6, 4, 2)
            fan_in, fan_out = init_ops_v2._compute_fans(shape)
            std = np.sqrt(2. / (fan_in + fan_out))
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 1 other location - About 4 hrs to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 525..532

        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

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

          @test_util.run_in_graph_and_eager_modes
          def testHeNormal(self):
            shape = (5, 6, 4, 2)
            fan_in, _ = init_ops_v2._compute_fans(shape)
            std = np.sqrt(2. / fan_in)
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 3 other locations - About 4 hrs to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 550..557
        tensorflow/python/ops/init_ops_v2_test.py on lines 561..567
        tensorflow/python/ops/init_ops_v2_test.py on lines 569..576

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

        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

          @test_util.run_in_graph_and_eager_modes
          def testLecunNormal(self):
            shape = (5, 6, 4, 2)
            fan_in, _ = init_ops_v2._compute_fans(shape)
            std = np.sqrt(1. / fan_in)
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 3 other locations - About 4 hrs to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 550..557
        tensorflow/python/ops/init_ops_v2_test.py on lines 561..567
        tensorflow/python/ops/init_ops_v2_test.py on lines 580..586

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

        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

          @test_util.run_in_graph_and_eager_modes
          def testLecunUniform(self):
            shape = (5, 6, 4, 2)
            fan_in, _ = init_ops_v2._compute_fans(shape)
            std = np.sqrt(1. / fan_in)
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 3 other locations - About 4 hrs to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 561..567
        tensorflow/python/ops/init_ops_v2_test.py on lines 569..576
        tensorflow/python/ops/init_ops_v2_test.py on lines 580..586

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

        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

          @test_util.run_in_graph_and_eager_modes
          def testHeUniform(self):
            shape = (5, 6, 4, 2)
            fan_in, _ = init_ops_v2._compute_fans(shape)
            std = np.sqrt(2. / fan_in)
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 3 other locations - About 4 hrs to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 550..557
        tensorflow/python/ops/init_ops_v2_test.py on lines 569..576
        tensorflow/python/ops/init_ops_v2_test.py on lines 580..586

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

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

          @test_util.run_in_graph_and_eager_modes
          def testInitializerIdentical(self):
            self.skipTest("Doesn't work without the graphs")
            init1 = init_ops_v2.RandomUniform(0, 7, seed=1)
            init2 = init_ops_v2.RandomUniform(0, 7, seed=1)
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 2 other locations - About 3 hrs to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 238..243
        tensorflow/python/ops/init_ops_v2_test.py on lines 276..281

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

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

          @test_util.run_in_graph_and_eager_modes
          def testInitializerIdentical(self):
            self.skipTest("Doesn't work without the graphs")
            init1 = init_ops_v2.RandomNormal(0, 7, seed=1)
            init2 = init_ops_v2.RandomNormal(0, 7, seed=1)
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 2 other locations - About 3 hrs to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 204..209
        tensorflow/python/ops/init_ops_v2_test.py on lines 276..281

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

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

          @test_util.run_in_graph_and_eager_modes
          def testInitializerIdentical(self):
            self.skipTest("Not seeming to work in Eager mode")
            init1 = init_ops_v2.TruncatedNormal(0.0, 1.0, seed=1)
            init2 = init_ops_v2.TruncatedNormal(0.0, 1.0, seed=1)
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 2 other locations - About 3 hrs to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 204..209
        tensorflow/python/ops/init_ops_v2_test.py on lines 238..243

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

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

          @test_util.run_in_graph_and_eager_modes
          def testInitializerDifferent(self):
            init1 = init_ops_v2.RandomNormal(0, 7, seed=1)
            init2 = init_ops_v2.RandomNormal(0, 7, seed=2)
            self._identical_test(init1, init2, False)
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 2 other locations - About 2 hrs to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 211..215
        tensorflow/python/ops/init_ops_v2_test.py on lines 283..287

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

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

          @test_util.run_in_graph_and_eager_modes
          def testInitializerDifferent(self):
            init1 = init_ops_v2.RandomUniform(0, 7, seed=1)
            init2 = init_ops_v2.RandomUniform(0, 7, seed=2)
            self._identical_test(init1, init2, False)
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 2 other locations - About 2 hrs to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 245..249
        tensorflow/python/ops/init_ops_v2_test.py on lines 283..287

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

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

          @test_util.run_in_graph_and_eager_modes
          def testInitializerDifferent(self):
            init1 = init_ops_v2.TruncatedNormal(0.0, 1.0, seed=1)
            init2 = init_ops_v2.TruncatedNormal(0.0, 1.0, seed=2)
            self._identical_test(init1, init2, False)
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 2 other locations - About 2 hrs to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 211..215
        tensorflow/python/ops/init_ops_v2_test.py on lines 245..249

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

        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

            with test_util.use_gpu():
              self.assertRaises(ValueError, init, shape=[5, 7, 7])
              self.assertRaises(ValueError, init, shape=[5])
              self.assertRaises(ValueError, init, shape=[])
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 1 other location - About 1 hr to fix
        tensorflow/python/kernel_tests/array_ops/init_ops_test.py on lines 1103..1106

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

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

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

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

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

        Refactorings

        Further Reading

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

          @test_util.run_in_graph_and_eager_modes
          def testInvalidDataType(self):
            init = init_ops_v2.Identity()
            self.assertRaises(ValueError, init, shape=[10, 5], dtype=dtypes.int32)
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 1 other location - About 1 hr to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 413..416

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

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

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

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

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

        Refactorings

        Further Reading

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

          @test_util.run_in_graph_and_eager_modes
          def testInvalidDataType(self):
            init = init_ops_v2.Orthogonal()
            self.assertRaises(ValueError, init, shape=(10, 10), dtype=dtypes.string)
        Severity: Major
        Found in tensorflow/python/ops/init_ops_v2_test.py and 1 other location - About 1 hr to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 480..483

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

        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

                t = t.reshape((np.prod(t.shape[:-1]), t.shape[-1]))
        Severity: Minor
        Found in tensorflow/python/ops/init_ops_v2_test.py and 1 other location - About 50 mins to fix
        tensorflow/python/kernel_tests/array_ops/init_ops_test.py on lines 830..830

        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

          @test_util.run_in_graph_and_eager_modes
          def testZeros(self):
            self._range_test(
                init_ops_v2.Zeros(), shape=(4, 5), target_mean=0., target_max=0.)
        Severity: Minor
        Found in tensorflow/python/ops/init_ops_v2_test.py and 1 other location - About 50 mins to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 109..112

        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

          @test_util.run_in_graph_and_eager_modes
          def testOnes(self):
            self._range_test(
                init_ops_v2.Ones(), shape=(4, 5), target_mean=1., target_max=1.)
        Severity: Minor
        Found in tensorflow/python/ops/init_ops_v2_test.py and 1 other location - About 50 mins to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 92..95

        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

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

              self._range_test(
                  init_ops_v2.Identity(),
                  shape=shape,
                  target_mean=1. / shape[0],
        Severity: Minor
        Found in tensorflow/python/ops/init_ops_v2_test.py and 1 other location - About 45 mins to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 474..477

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

        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

            self._range_test(
                init_ops_v2.Identity(),
                shape=shape,
                target_mean=1. / shape[0],
        Severity: Minor
        Found in tensorflow/python/ops/init_ops_v2_test.py and 1 other location - About 45 mins to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 467..470

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

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

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

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

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

        Refactorings

        Further Reading

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

          @test_util.run_in_graph_and_eager_modes
          def testInitializePartition(self):
            init = init_ops_v2.RandomUniform(0, 7, seed=1)
            self._partition_test(init)
        Severity: Minor
        Found in tensorflow/python/ops/init_ops_v2_test.py and 1 other location - About 45 mins to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 294..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 35.

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

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

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

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

        Refactorings

        Further Reading

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

          @test_util.run_in_graph_and_eager_modes
          def testInitializePartition(self):
            init = init_ops_v2.TruncatedNormal(0.0, 1.0, seed=1)
            self._partition_test(init)
        Severity: Minor
        Found in tensorflow/python/ops/init_ops_v2_test.py and 1 other location - About 45 mins to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 222..225

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

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

            with self.assertRaisesWithLiteralMatch(
                ValueError,
                r"Constant initializer doesn't support partition-related arguments"):
              init((4, 2), dtype=dtypes.float32, partition_shape=(2, 2))
        Severity: Minor
        Found in tensorflow/python/ops/init_ops_v2_test.py and 2 other locations - About 35 mins to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 455..458
        tensorflow/python/ops/init_ops_v2_test.py on lines 517..520

        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

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

            with self.assertRaisesWithLiteralMatch(
                ValueError,
                r"Identity initializer doesn't support partition-related arguments"):
              init((4, 2), dtype=dtypes.float32, partition_shape=(2, 2))
        Severity: Minor
        Found in tensorflow/python/ops/init_ops_v2_test.py and 2 other locations - About 35 mins to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 131..134
        tensorflow/python/ops/init_ops_v2_test.py on lines 455..458

        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

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

            with self.assertRaisesWithLiteralMatch(
                ValueError,
                r"Orthogonal initializer doesn't support partition-related arguments"):
              init((4, 2), dtype=dtypes.float32, partition_shape=(2, 2))
        Severity: Minor
        Found in tensorflow/python/ops/init_ops_v2_test.py and 2 other locations - About 35 mins to fix
        tensorflow/python/ops/init_ops_v2_test.py on lines 131..134
        tensorflow/python/ops/init_ops_v2_test.py on lines 517..520

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 33.

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

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

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

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

        Refactorings

        Further Reading

        There are no issues that match your filters.

        Category
        Status