tensorflow/tensorflow

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

Summary

Maintainability
F
1 wk
Test Coverage

File rnn_test.py has 674 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/rnn_test.py - About 1 day to fix

    Function benchmarkStaticUnrollStateConcatVsStateTuple has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def benchmarkStaticUnrollStateConcatVsStateTuple(self):
        print("Calculation: Static Unroll with Concatenated State "
              "vs. Tuple State")
        print("batch \t time \t units \t gpu \t dt(concat_state) "
              "\t dt(tuple_state) \t dt(concat_state)/dt(tuple_state)")
    Severity: Minor
    Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py - About 1 hr 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 benchmarkStaticUnrollHalfSequenceLengthVsHalfUnroll has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def benchmarkStaticUnrollHalfSequenceLengthVsHalfUnroll(self):
        print("Calculation: Static Unroll with Halved Sequence Length "
              "vs. Half Static Unroll")
        print("batch \t full_t \t units \t gpu \t dt(half_seq_len) "
              "\t dt(unroll_half) \t dt(half_seq_len)/dt(unroll_half)")
    Severity: Minor
    Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py - About 1 hr 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 benchmarkStaticUnrollVsDynamicFlowLSTM has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def benchmarkStaticUnrollVsDynamicFlowLSTM(self):
        print("Calculation: Static Unroll with Dynamic Flow LSTM "
              "vs. Dynamic Unroll LSTM")
        print("batch \t max_t \t units \t gpu \t dt(static) \t dt(dynamic) "
              "\t dt(dynamic)/dt(static)")
    Severity: Minor
    Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py - About 1 hr 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 rnn_long_sequence_benchmark has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def rnn_long_sequence_benchmark(batch_size, seqlen, num_units, dynamic,
    Severity: Minor
    Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py - About 45 mins to fix

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

        def _assert_cell_builds(self, cell_class, dtype, batch_size, in_size,
      Severity: Minor
      Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py - About 35 mins to fix

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

          def benchmarkDynamicLSTMNoMemorySwapVsMemorySwap(self):
            print("Calculation: Dynamic LSTM No Memory Swap vs. Memory Swap")
            print("batch \t max_t \t units \t no_swap \t swap \t swap/no_swap")
            for batch_size in (256, 512):
              for max_time in (100,):
        Severity: Minor
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py - About 25 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

        def _static_vs_dynamic_rnn_benchmark_static(inputs_list_t, sequence_length):
          (_, input_size) = inputs_list_t[0].get_shape().as_list()
          initializer = init_ops.random_uniform_initializer(-0.01, 0.01, seed=127)
          cell = rnn_cell_impl.LSTMCell(
              num_units=input_size,
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 1 other location - About 1 day to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 491..510

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 143.

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

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

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

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

        Refactorings

        Further Reading

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

        def _half_seq_len_vs_unroll_half_rnn_benchmark(inputs_list_t, sequence_length):
          (_, input_size) = inputs_list_t[0].get_shape().as_list()
          initializer = init_ops.random_uniform_initializer(-0.01, 0.01, seed=127)
          cell = rnn_cell_impl.LSTMCell(
              num_units=input_size,
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 1 other location - About 1 day to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 358..377

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 143.

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

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

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

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

        Refactorings

        Further Reading

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

          with session.Session(config=config, graph=ops_lib.Graph()) as sess:
            with ops_lib.device("/cpu:0" if not use_gpu else None):
              inputs_list_t = [
                  variables_lib.Variable(
                      x, trainable=False).value() for x in inputs_list
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 1 other location - About 6 hrs to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 607..616

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 103.

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

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

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

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

        Refactorings

        Further Reading

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

          with session.Session(config=config, graph=ops_lib.Graph()) as sess:
            with ops_lib.device("/cpu:0" if not use_gpu else None):
              inputs_list_t = [
                  variables_lib.Variable(
                      x, trainable=False).value() for x in inputs_list
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 1 other location - About 6 hrs to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 595..604

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 103.

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

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

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

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

        Refactorings

        Further Reading

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

            with self.cached_session() as sess:
              outputs, state = rnn.dynamic_rnn(
                  cell, inputs, dtype=dtypes.float32, sequence_length=[4])
              if not in_eager_mode:
                outputs, state = sess.run(
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 1 other location - About 4 hrs to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 231..236

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

        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.cached_session() as sess:
              outputs, state = rnn.dynamic_rnn(
                  cell, inputs, dtype=dtypes.float32, sequence_length=[4])
              if not in_eager_mode:
                outputs, state = sess.run(
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 1 other location - About 4 hrs to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 211..216

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

        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

                for num_units in (256,):
                  for use_gpu in (False, True):
                    s_dt, d_dt = half_seq_len_vs_unroll_half_rnn_benchmark(batch_size,
                                                                           max_time,
                                                                           num_units,
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 2 other locations - About 4 hrs to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 742..753
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 809..824

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

        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

                for num_units in (
                    16,
                    128,):
                  for use_gpu in (False, True):
                    c_dt, t_dt = concat_state_vs_tuple_state_rnn_benchmark(batch_size,
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 2 other locations - About 4 hrs to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 742..753
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 783..796

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

        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

                for num_units in (512, 256, 128):
                  for use_gpu in (False, True):
                    s_dt, d_dt = static_vs_dynamic_rnn_benchmark(batch_size, max_time,
                                                                 num_units, use_gpu)
                    self.report_benchmark(
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 2 other locations - About 4 hrs to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 783..796
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 809..824

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

        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

            if dynamic:
              with session.Session(config=config, graph=ops_lib.Graph()) as sess:
                inputs_t = variables_lib.Variable(inputs, trainable=False).value()
                ops = _dynamic_rnn_swap_memory_benchmark(
                    inputs_t, sequence_length, swap_memory=swap_memory)
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 2 other locations - About 4 hrs to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 661..666
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 669..674

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

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

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

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

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

        Refactorings

        Further Reading

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

          with session.Session(config=config, graph=ops_lib.Graph()) as sess:
            inputs_t = variables_lib.Variable(inputs, trainable=False).value()
            ops = _dynamic_rnn_swap_memory_benchmark(
                inputs_t, sequence_length, swap_memory=True)
            variables_lib.global_variables_initializer().run()
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 2 other locations - About 4 hrs to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 661..666
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 696..702

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

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

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

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

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

        Refactorings

        Further Reading

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

          with session.Session(config=config, graph=ops_lib.Graph()) as sess:
            inputs_t = variables_lib.Variable(inputs, trainable=False).value()
            ops = _dynamic_rnn_swap_memory_benchmark(
                inputs_t, sequence_length, swap_memory=False)
            variables_lib.global_variables_initializer().run()
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 2 other locations - About 4 hrs to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 669..674
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 696..702

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

        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 Plus1RNNCell(rnn_cell_impl.RNNCell):
          """RNN Cell generating (output, new_state) = (input + 1, state + 1)."""
        
          @property
          def output_size(self):
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 1 other location - About 2 hrs to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_cell_test.py on lines 59..71

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 60.

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

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

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

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

        Refactorings

        Further Reading

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

            if in_eager_mode:
              inputs = np.array([[[1], [2], [3], [4]]], dtype=np.float32)
            else:
              inputs = array_ops.placeholder(dtypes.float32, shape=(1, 4, 1))
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 2 other locations - About 2 hrs to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 206..209
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 226..229

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

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

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

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

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

        Refactorings

        Further Reading

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

            if in_eager_mode:
              inputs = np.array([[[1], [2], [3], [4]]], dtype=np.float32)
            else:
              inputs = array_ops.placeholder(dtypes.float32, shape=(1, 4, 1))
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 2 other locations - About 2 hrs to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 206..209
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 256..259

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

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

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

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

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

        Refactorings

        Further Reading

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

            if in_eager_mode:
              inputs = np.array([[[1], [2], [3], [4]]], dtype=np.float32)
            else:
              inputs = array_ops.placeholder(dtypes.float32, shape=(1, 4, 1))
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 2 other locations - About 2 hrs to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 226..229
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 256..259

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

        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

              basic_cell(array_ops.ones([1, 1]),
                         state=basic_cell.get_initial_state(inputs=None,
                                                            batch_size=1,
                                                            dtype=dtypes.float32))
        Severity: Minor
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 1 other location - About 50 mins to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 346..349

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 36.

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

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

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

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

        Refactorings

        Further Reading

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

              lstm_cell(array_ops.ones([1, 1]),
                        state=lstm_cell.get_initial_state(inputs=None,
                                                          batch_size=1,
                                                          dtype=dtypes.float32))
        Severity: Minor
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 1 other location - About 50 mins to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 334..337

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 36.

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

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

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

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

        Refactorings

        Further Reading

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

          inputs_list = [
              np.random.randn(batch_size, num_units).astype(np.float32)
              for _ in range(max_time)
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 5 other locations - About 40 mins to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 410..412
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 521..523
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 589..591
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 654..656
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 689..691

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 34.

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

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

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

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

        Refactorings

        Further Reading

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

          inputs_list = [
              np.random.randn(batch_size, num_units).astype(np.float32)
              for _ in range(seqlen)
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 5 other locations - About 40 mins to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 410..412
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 458..460
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 521..523
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 589..591
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 654..656

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 34.

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

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

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

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

        Refactorings

        Further Reading

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

          inputs_list = [
              np.random.randn(batch_size, num_units).astype(np.float32)
              for _ in range(max_time)
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 5 other locations - About 40 mins to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 410..412
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 458..460
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 521..523
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 654..656
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 689..691

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 34.

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

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

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

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

        Refactorings

        Further Reading

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

          inputs_list = [
              np.random.randn(batch_size, num_units).astype(np.float32)
              for _ in range(max_time)
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 5 other locations - About 40 mins to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 410..412
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 458..460
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 521..523
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 589..591
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 689..691

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 34.

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

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

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

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

        Refactorings

        Further Reading

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

          inputs_list = [
              np.random.randn(batch_size, num_units).astype(np.float32)
              for _ in range(max_time)
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 5 other locations - About 40 mins to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 458..460
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 521..523
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 589..591
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 654..656
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 689..691

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 34.

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

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

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

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

        Refactorings

        Further Reading

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

          inputs_list = [
              np.random.randn(batch_size, num_units).astype(np.float32)
              for _ in range(max_time)
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/rnn_test.py and 5 other locations - About 40 mins to fix
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 410..412
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 458..460
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 589..591
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 654..656
        tensorflow/python/kernel_tests/nn_ops/rnn_test.py on lines 689..691

        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