tensorflow/tensorflow

View on GitHub

Showing 21,100 of 21,100 total issues

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

    for c in [c0, c1, c2, c3]:
      # where_v2 only
      x = np.random.rand(1, 3, 2) * 100
      y = np.random.rand(1, 1, 1) * 100
      self._testBasicBroadcast(array_ops.where_v2, c, x, y)
tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 496..524

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

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 self.subTest(c=c):
        x = np.random.rand(1, 3, 2) * 100
        y = np.random.rand(1, 1, 1) * 100
        self._testBasicBroadcast(array_ops.where_v2, c, x, y)
        self._testBasicBroadcast(array_ops.where_v2, c, y, x)
Severity: Major
Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 4 days to fix
tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5298..5327

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

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

File session_test.py has 1755 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/client/session_test.py - About 4 days to fix

    ControlFlowTest has 233 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ControlFlowTest(test.TestCase, parameterized.TestCase):
    
      @test_util.run_v1_only("b/120545219")
      def testRefIdentity(self):
        with self.cached_session():

      File while_v2_test.py has 1726 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
      #
      # Licensed under the Apache License, Version 2.0 (the "License");
      # you may not use this file except in compliance with the License.
      # You may obtain a copy of the License at
      Severity: Major
      Found in tensorflow/python/kernel_tests/control_flow/while_v2_test.py - About 4 days to fix

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

              with self.subTest(t=t):
                x = np.random.rand(1, 3, 2) * 100
                y = np.random.rand(1, 1, 1) * 100
                self._compareGradientX(array_ops.where_v2, c, x.astype(t), y.astype(t))
                x = np.random.rand(1, 3, 2) * 100
        Severity: Major
        Found in tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py and 1 other location - About 4 days to fix
        tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 5356..5378

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

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

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

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

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

        Refactorings

        Further Reading

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

            for t in [np.float32, np.float64]:
              # where_v2 only
              x = np.random.rand(1, 3, 2) * 100
              y = np.random.rand(1, 1, 1) * 100
              self._compareGradientX(array_ops.where_v2, c, x.astype(t), y.astype(t))
        tensorflow/python/kernel_tests/math_ops/cwise_ops_test.py on lines 556..577

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

        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

        File layout_optimizer_test.py has 1710 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # Copyright 2017 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/grappler/layout_optimizer_test.py - About 4 days to fix

          File tpu_embedding_v3.py has 1709 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # Copyright 2023 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/tpu/tpu_embedding_v3.py - About 4 days to fix

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

            class AnyReductionTest(test.TestCase):
            
              def _compare(self, x, reduction_axes, keepdims, use_gpu=False):
                np_ans = x
                if reduction_axes is None:
            Severity: Major
            Found in tensorflow/python/kernel_tests/math_ops/reduction_ops_test.py and 1 other location - About 4 days to fix
            tensorflow/python/kernel_tests/math_ops/reduction_ops_test.py on lines 1068..1114

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

            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

            class AllReductionTest(test.TestCase):
            
              def _compare(self, x, reduction_axes, keepdims, use_gpu=False):
                np_ans = x
                if reduction_axes is None:
            Severity: Major
            Found in tensorflow/python/kernel_tests/math_ops/reduction_ops_test.py and 1 other location - About 4 days to fix
            tensorflow/python/kernel_tests/math_ops/reduction_ops_test.py on lines 1117..1163

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

            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

            File control_flow_ops.py has 1701 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/ops/control_flow_ops.py - About 4 days to fix

              File analyzer_cli_test.py has 1697 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
              #
              # Licensed under the Apache License, Version 2.0 (the "License");
              # you may not use this file except in compliance with the License.
              # You may obtain a copy of the License at
              Severity: Major
              Found in tensorflow/python/debug/cli/analyzer_cli_test.py - About 4 days to fix

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

                  def testMultiDequeueUpToPartiallyKnownShapesAndVariableInputNoBlocking(self):
                    with self.cached_session() as sess:
                      q = data_flow_ops.PaddingFIFOQueue(
                          10, (dtypes_lib.string, dtypes_lib.int32),
                          shapes=((None,), (1, None)))
                tensorflow/python/kernel_tests/data_structures/padding_fifo_queue_test.py on lines 453..492

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

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

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

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

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

                Refactorings

                Further Reading

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

                  def testMultiDequeueManyWithPartiallyKnownShapesAndVariableSizeInput(self):
                    with self.cached_session() as sess:
                      q = data_flow_ops.PaddingFIFOQueue(
                          10, (dtypes_lib.string, dtypes_lib.int32),
                          shapes=((None,), (1, None)))
                tensorflow/python/kernel_tests/data_structures/padding_fifo_queue_test.py on lines 494..533

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

                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

                File backprop_test.py has 1673 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # Copyright 2017 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/eager/backprop_test.py - About 4 days to fix

                  File losses.py has 1672 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/keras/losses.py - About 4 days to fix

                    File input_lib_test.py has 1666 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
                    #
                    # Licensed under the Apache License, Version 2.0 (the "License");
                    # you may not use this file except in compliance with the License.
                    # You may obtain a copy of the License at
                    Severity: Major
                    Found in tensorflow/python/distribute/input_lib_test.py - About 4 days to fix

                      File np_array_ops.py has 1661 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      # Copyright 2020 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/ops/numpy_ops/np_array_ops.py - About 4 days to fix

                        File nn_test.py has 1655 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/ops/nn_test.py - About 4 days to fix
                          Severity
                          Category
                          Status
                          Source
                          Language