tensorflow/tensorflow

View on GitHub
tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py

Summary

Maintainability
F
2 wks
Test Coverage

File embedding_ops_test.py has 1163 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2015 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/kernel_tests/nn_ops/embedding_ops_test.py - About 2 days to fix

    Function _EmbeddingResult has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def _EmbeddingResult(params,
                         id_vals,
                         num_shards,
                         vocab_size,
                         partition_strategy="mod",
    Severity: Minor
    Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

    def _EmbeddingParams(num_shards,
                         vocab_size,
                         dtype=dtypes.float32,
                         shape=None,
                         use_shapeless_placeholder=False):
    Severity: Minor
    Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py - About 55 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

      def testEmbeddingLookupSparse(
    Severity: Minor
    Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py - About 45 mins to fix

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

        def testGradientsEmbeddingLookupSparse(
      Severity: Minor
      Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py - About 45 mins to fix

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

          def testResourceVariableGradientEmbeddingLookupSparse(self):
            """Explicitly checks the gradient of a sparse embedding lookup with
        
            ResourceVariable input.
            """
        Severity: Minor
        Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py - About 45 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

          def _ExpectedSparseGradient(
        Severity: Minor
        Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py - About 45 mins to fix

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

          def _EmbeddingResult(params,
          Severity: Minor
          Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py - About 45 mins to fix

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

            def _EmbeddingParams(num_shards,
            Severity: Minor
            Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py - About 35 mins to fix

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

              def _EmbeddingParamsAsPartitionedVariable(num_shards,
              Severity: Minor
              Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py - About 35 mins to fix

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

                  def testHigherRank(self):
                    np.random.seed(8)
                    with self.cached_session():
                      for params_shape in (12,), (6, 3):
                        params = np.random.randn(*params_shape)
                Severity: Minor
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_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

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

                  def _ExpectedSparseGradient(
                      self, nnz, param_shape, np_type, sp_ids, sp_weights, combiner
                  ):
                    """Returns the expected indices and values corresponding to the (sparse)
                
                
                Severity: Minor
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_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

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

                  def testHigherRankMaxNorm(self):
                    np.random.seed(8)
                    with self.cached_session():
                      for params_shape in (12,), (6, 3), (6, 2, 3):
                        # Test embedding rank 0, 1, 2.
                Severity: Minor
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_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

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

                  def testEmbeddingLookupSparse(
                      self,
                      num_shards,
                      combiner,
                      dtype,
                Severity: Minor
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_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

                  @test_util.run_deprecated_v1
                  def testShardedDivPartitioningInt32Ids(self):
                    with self.cached_session():
                      num_shards = 5
                      vocab_size = 13
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 1 other location - About 1 day to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 439..462

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

                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_deprecated_v1
                  def testShardedDivPartitioningInt64Ids(self):
                    with self.cached_session():
                      num_shards = 5
                      vocab_size = 13
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 1 other location - About 1 day to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 388..411

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 154.

                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_deprecated_v1
                  def testShardedModPartitioningInt32Ids(self):
                    with self.cached_session():
                      num_shards = 5
                      vocab_size = 13
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 1 other location - About 1 day to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 365..386

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 146.

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

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

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

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

                Refactorings

                Further Reading

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

                  @test_util.run_deprecated_v1
                  def testShardedModPartitioningInt64Ids(self):
                    with self.cached_session():
                      num_shards = 5
                      vocab_size = 13
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 1 other location - About 1 day to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 342..363

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 146.

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

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

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

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

                Refactorings

                Further Reading

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

                  @test_util.run_deprecated_v1
                  def testCint32Cpu(self):
                    with self.session(use_gpu=False):
                      indices = [
                          ops.convert_to_tensor([0, 1, 2]),
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 1 other location - About 6 hrs to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1344..1356

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

                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_deprecated_v1
                  def testInt32Cpu(self):
                    with self.session(use_gpu=False):
                      indices = [
                          ops.convert_to_tensor([0, 1, 2]),
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 1 other location - About 6 hrs to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1316..1328

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

                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_deprecated_v1
                  def testCint32Gpu(self):
                    with self.session():
                      indices = [
                          ops.convert_to_tensor([0, 1, 2]),
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 1 other location - About 5 hrs to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1358..1370

                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

                  @test_util.run_deprecated_v1
                  def testInt32Gpu(self):
                    with self.session():
                      indices = [
                          ops.convert_to_tensor([0, 1, 2]),
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 1 other location - About 5 hrs to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1330..1342

                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

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

                          [[(1.0 * embedding_weights[0][0] + 2.0 * embedding_weights[0][1]) /
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1108..1108
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1137..1137
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1238..1238

                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

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

                              (1.0 * embedding_weights[0][0] + 2.0 * embedding_weights[0][1])
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1137..1137
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1238..1238
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1254..1254

                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

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

                              (1.0 * embedding_weights[0][0] + 2.0 * embedding_weights[0][1])
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1108..1108
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1238..1238
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1254..1254

                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

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

                          (1.0 * embedding_weights[0][0] + 2.0 * embedding_weights[0][1]) / 3.0,
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1108..1108
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1137..1137
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1254..1254

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

                      sp_weights = sparse_tensor.SparseTensor(
                          constant_op.constant(indices_weights, dtypes.int64),
                          constant_op.constant([12.0, 5.0], dtypes.float32),
                          constant_op.constant([1, 2], dtypes.int64),
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 784..787
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 789..792
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 896..899
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 901..904

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 46.

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

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

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

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

                Refactorings

                Further Reading

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

                      sp_ids = sparse_tensor.SparseTensor(
                          constant_op.constant(indices, dtypes.int64),
                          constant_op.constant([0, 2], dtypes.int32),
                          constant_op.constant([4, 1], dtypes.int64),
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 784..787
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 789..792
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 873..876
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 901..904

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 46.

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

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

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

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

                Refactorings

                Further Reading

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

                      sp_ids = sparse_tensor.SparseTensor(
                          constant_op.constant(indices, dtypes.int64),
                          constant_op.constant([0, 2], dtypes.int32),
                          constant_op.constant([4, 1], dtypes.int64),
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 789..792
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 873..876
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 896..899
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 901..904

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 46.

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

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

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

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

                Refactorings

                Further Reading

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

                      sp_weights = sparse_tensor.SparseTensor(
                          constant_op.constant(indices, dtypes.int64),
                          constant_op.constant([1, 1], dtypes.float32),
                          constant_op.constant([4, 1], dtypes.int64),
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 784..787
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 789..792
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 873..876
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 896..899

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 46.

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

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

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

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

                Refactorings

                Further Reading

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

                      sp_weights = sparse_tensor.SparseTensor(
                          constant_op.constant(indices, dtypes.int64),
                          constant_op.constant([1, 1], dtypes.float32),
                          constant_op.constant([4, 1], dtypes.int64),
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 784..787
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 873..876
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 896..899
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 901..904

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 46.

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

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

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

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

                Refactorings

                Further Reading

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

                          ids = np.random.randint(
                              params.shape[0], size=np.prod(ids_shape,
                                                            dtype=np.int64)).reshape(ids_shape)
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 1 other location - About 1 hr to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 625..627

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

                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

                        ids = np.random.randint(
                            params.shape[0], size=np.prod(ids_shape,
                                                          dtype=np.int64)).reshape(ids_shape)
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 1 other location - About 1 hr to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 584..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 43.

                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

                    indices = [[0, 0, 0], [0, 0, 1], [0, 0, 2], [0, 1, 0], [1, 0, 0], [1, 1, 0],
                               [1, 1, 1]]
                tensorflow/python/kernel_tests/linalg/tridiagonal_solve_op_test.py on lines 658..659
                tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 105..106

                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

                        y_shape = [num_ids] + list(params[_PName(0) + ":0"].shape[1:])
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 1 other location - About 1 hr to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 855..855

                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

                      y_shape = [batch_size] + list(params[_PName(0) + ":0"].shape[1:])
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 1 other location - About 1 hr to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 525..525

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

                    sparse_weights = sparse_tensor.SparseTensor(
                        constant_op.constant(indices, dtypes.int64),
                        constant_op.constant(weights, dtypes.float32),
                        constant_op.constant(shape, dtypes.int64))
                tensorflow/python/kernel_tests/logging_ops_test.py on lines 224..227
                tensorflow/python/kernel_tests/logging_ops_test.py on lines 246..249
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 675..678
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 679..682
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1047..1050
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1052..1055
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1077..1080
                tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 479..482

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

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

                    sp_ids = sparse_tensor.SparseTensor(
                        constant_op.constant(indices, dtypes.int64),
                        constant_op.constant(ids, dtypes.int32),
                        constant_op.constant(shape, dtypes.int64))
                tensorflow/python/kernel_tests/logging_ops_test.py on lines 224..227
                tensorflow/python/kernel_tests/logging_ops_test.py on lines 246..249
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 679..682
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1047..1050
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1052..1055
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1077..1080
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1082..1085
                tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 479..482

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

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

                    sp_weights = sparse_tensor.SparseTensor(
                        constant_op.constant(indices, dtypes.int64),
                        constant_op.constant(weights, dtypes.float32),
                        constant_op.constant(shape, dtypes.int64))
                tensorflow/python/kernel_tests/logging_ops_test.py on lines 224..227
                tensorflow/python/kernel_tests/logging_ops_test.py on lines 246..249
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 675..678
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1047..1050
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1052..1055
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1077..1080
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1082..1085
                tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 479..482

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

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

                    sparse_ids = sparse_tensor.SparseTensor(
                        constant_op.constant(indices, dtypes.int64),
                        constant_op.constant(ids, dtypes.int64),
                        constant_op.constant(shape, dtypes.int64))
                tensorflow/python/kernel_tests/logging_ops_test.py on lines 224..227
                tensorflow/python/kernel_tests/logging_ops_test.py on lines 246..249
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 675..678
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 679..682
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1052..1055
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1077..1080
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1082..1085
                tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 479..482

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

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

                    sparse_ids = sparse_tensor.SparseTensor(
                        constant_op.constant(indices, dtypes.int64),
                        constant_op.constant(ids, dtypes.int64),
                        constant_op.constant(shape, dtypes.int64))
                tensorflow/python/kernel_tests/logging_ops_test.py on lines 224..227
                tensorflow/python/kernel_tests/logging_ops_test.py on lines 246..249
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 675..678
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 679..682
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1047..1050
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1052..1055
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1082..1085
                tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 479..482

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

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

                    sparse_weights = sparse_tensor.SparseTensor(
                        constant_op.constant(indices, dtypes.int64),
                        constant_op.constant(weights, dtypes.float32),
                        constant_op.constant(shape, dtypes.int64))
                tensorflow/python/kernel_tests/logging_ops_test.py on lines 224..227
                tensorflow/python/kernel_tests/logging_ops_test.py on lines 246..249
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 675..678
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 679..682
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1047..1050
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1077..1080
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1082..1085
                tensorflow/python/kernel_tests/sparse_ops/sparse_ops_test.py on lines 479..482

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

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

                              (embedding_weights[0][0] + embedding_weights[0][1]) / 2.0,
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 3 other locations - About 55 mins to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1165..1165
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1270..1271
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1275..1275

                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

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

                      self.assertAllClose(embedding_lookup_result, [[(
                          embedding_weights[0][0] + embedding_weights[0][1]) / 2.0, [0] * 4, [
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 3 other locations - About 55 mins to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1165..1165
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1169..1169
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1275..1275

                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

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

                              (embedding_weights[0][0] + embedding_weights[0][1]) / 2.0,
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 3 other locations - About 55 mins to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1169..1169
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1270..1271
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1275..1275

                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

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

                              (embedding_weights[0][0] + embedding_weights[0][1]) / 2.0, [0] * 4
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 3 other locations - About 55 mins to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1165..1165
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1169..1169
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 1270..1271

                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

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

                      indices = np.random.randint(shape[0], size=2 * shape[0])
                Severity: Minor
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 1 other location - About 45 mins to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 111..111

                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

                      indices = np.random.randint(shape[0], size=2 * shape[0])
                Severity: Minor
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 1 other location - About 45 mins to fix
                tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py on lines 119..119

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 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

                      if dtype == dtypes.bfloat16:
                        rtol = 1e-2
                      elif dtype == dtypes.float16:
                        rtol = 1e-3
                Severity: Minor
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 1 other location - About 45 mins to fix
                tensorflow/python/kernel_tests/random/random_ops_test.py on lines 318..321

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

                    indices = [[0, 0], [0, 1], [0, 2], [1, 0], [3, 0], [4, 0], [4, 1]]
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/embedding_ops_test.py and 6 other locations - About 40 mins to fix
                tensorflow/python/kernel_tests/logging_ops_test.py on lines 220..220
                tensorflow/python/kernel_tests/logging_ops_test.py on lines 242..242
                tensorflow/python/kernel_tests/math_ops/sets_test.py on lines 678..678
                tensorflow/python/kernel_tests/math_ops/sets_test.py on lines 1005..1005
                tensorflow/python/kernel_tests/math_ops/sets_test.py on lines 1033..1033
                tensorflow/python/ops/ragged/ragged_tensor_test.py on lines 706..706

                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

                There are no issues that match your filters.

                Category
                Status