deeplearning4j/deeplearning4j

View on GitHub

Showing 6,111 of 13,975 total issues

Method calcBackpropGradients has a Cognitive Complexity of 122 (exceeds 5 allowed). Consider refactoring.
Open

    protected void calcBackpropGradients(boolean clearLayers, boolean truncatedBPTT, INDArray... externalEpsilons) {
        if (flattenedGradients == null) {
            initGradientsView();
        }

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

Transforms has 126 methods (exceeds 20 allowed). Consider refactoring.
Open

public class Transforms {


    private Transforms() {
    }

    File SbeStatsReport.java has 972 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     *  ******************************************************************************
     *  *
     *  *
     *  * This program and the accompanying materials are made available under the

      Method checkGradients has a Cognitive Complexity of 119 (exceeds 5 allowed). Consider refactoring.
      Open

          public static boolean checkGradients(SameDiff sd, Map<String,INDArray> placeholderValues, double eps, double maxRelError, double minAbsError, boolean print,
                                               boolean exitOnFirstFailure, boolean skipValidation, boolean debugMode, Set<String> skipVariables, Map<String,INDArray> gradCheckMask,
                                               int maxPerParam, Subset subset) {
      
              boolean debugBefore = sd.isDebugMode();

      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

      File OpValidation.java has 962 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
       *  ******************************************************************************
       *  *
       *  *
       *  * This program and the accompanying materials are made available under the

        Method checkAllModelsForImport has a Cognitive Complexity of 117 (exceeds 5 allowed). Consider refactoring.
        Open

            public static TFImportStatus checkAllModelsForImport(File directory, String[] fileExtensions) throws IOException {
                Preconditions.checkState(directory.isDirectory(), "Specified directory %s is not actually a directory", directory);
        
        
                Collection<File> files = FileUtils.listFiles(directory, fileExtensions, true);

        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

        File ParagraphVectors.java has 947 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*
         *  ******************************************************************************
         *  *
         *  *
         *  * This program and the accompanying materials are made available under the

          Method initFunctionFromProperties has a Cognitive Complexity of 115 (exceeds 5 allowed). Consider refactoring.
          Open

              @Deprecated
              public static void initFunctionFromProperties(String mappedTfName, DifferentialFunction on, Map<String, AttrValue> attributesForNode, NodeDef node, GraphDef graph) {
                  val properties = on.mappingsForFunction();
                  val tfProperties = properties.get(mappedTfName);
                  val fields = DifferentialFunctionClassHolder.getInstance().getFieldsForFunction(on);

          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

          File DataSet.java has 938 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
           *  ******************************************************************************
           *  *
           *  *
           *  * This program and the accompanying materials are made available under the

            File FlatBuffersMapper.java has 935 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*
             *  ******************************************************************************
             *  *
             *  *
             *  * This program and the accompanying materials are made available under the

              Method activateHelper has a Cognitive Complexity of 111 (exceeds 5 allowed). Consider refactoring.
              Open

                  static public FwdPassReturn activateHelper(final BaseRecurrentLayer layer, final NeuralNetConfiguration conf,
                                                             final IActivation gateActivationFn, //Activation function for the gates - sigmoid or hard sigmoid (must be found in range 0 to 1)
                                                             INDArray input, final INDArray recurrentWeights, //Shape: [hiddenLayerSize,4*hiddenLayerSize+3]; order: [wI,wF,wO,wG,wFF,wOO,wGG]
                                                             final INDArray originalInputWeights, //Shape: [n^(L-1),4*hiddenLayerSize]; order: [wi,wf,wo,wg]
                                                             final INDArray biases, //Shape: [4,hiddenLayerSize]; order: [bi,bf,bo,bg]^T

              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

              File NDMath.java has 903 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*
               *  ******************************************************************************
               *  *
               *  *
               *  * This program and the accompanying materials are made available under the

                File SequenceVectors.java has 879 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /*
                 *  ******************************************************************************
                 *  *
                 *  *
                 *  * This program and the accompanying materials are made available under the

                  BaseNDArrayFactory has 110 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  public abstract class BaseNDArrayFactory implements NDArrayFactory {
                  
                      // We don't really care about dtype field we'll use context instead
                      // protected DataType dtype;
                      protected char order;

                    File SDVariable.java has 874 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /*
                     *  ******************************************************************************
                     *  *
                     *  *
                     *  * This program and the accompanying materials are made available under the

                      Method getAndParameterizeOp has a Cognitive Complexity of 105 (exceeds 5 allowed). Consider refactoring.
                      Open

                          @Override
                          public Pair<SameDiffOp,OpContext> getAndParameterizeOp(String opName, FrameIter frameIter, Set<VarId> opInputs, Set<VarId> allIterInputs,
                                                                                 Set<String> constAndPhInputs, Map<String, INDArray> placeholderValues, Set<String> allReqVariables, Map<String, SDValue> otherPlaceholders) {
                              SameDiffOp sdo = sameDiff.getOps().get(opName);
                              DifferentialFunction df = sdo.getOp();

                      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

                      Method mapWeightInitialization has a Cognitive Complexity of 104 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static IWeightInit mapWeightInitialization(String kerasInit,
                                                                            KerasLayerConfiguration conf,
                                                                            Map<String, Object> initConfig,
                                                                            int kerasMajorVersion)
                                  throws UnsupportedKerasConfigurationException, InvalidKerasConfigurationException {

                      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

                      MappingRule has 108 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                        public static final class MappingRule extends
                            org.nd4j.shade.protobuf.GeneratedMessageV3 implements
                            // @@protoc_insertion_point(message_implements:org.nd4j.ir.MappingRule)
                            MappingRuleOrBuilder {
                        private static final long serialVersionUID = 0L;

                        File AbstractSession.java has 857 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /*
                         *  ******************************************************************************
                         *  *
                         *  *
                         *  * This program and the accompanying materials are made available under the

                          Method fromFlatBuffers has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static SameDiff fromFlatBuffers(ByteBuffer bbIn, boolean loadUpdaterState) throws IOException {
                          
                                  FlatGraph fg = FlatGraph.getRootAsFlatGraph(bbIn);
                          
                                  int numOps = fg.nodesLength();

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language