deeplearning4j/deeplearning4j

View on GitHub

Showing 6,111 of 13,975 total issues

Function readGraphStructure has 244 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function readGraphStructure(){
    //First: load data
    if (file) {
        var fr = new FileReader();
        var fileData = new Blob([file]);            //TODO Don't load the whole file into memory at once!

    File CudaZeroHandler.java has 573 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      Method asFlatBuffers has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
      Open

          public ByteBuffer asFlatBuffers(long graphId, @NonNull ExecutorConfiguration configuration, boolean includeUpdaterState) {
              Nd4j.getExecutioner().commit();
              val bufferBuilder = new FlatBufferBuilder(1024);
              val idCounter = new AtomicInteger(0);
      
      

      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 checkDeserializedEquality has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
      Open

          public static void checkDeserializedEquality(SameDiff original, ByteBuffer bbSerialized, TestCase tc) {
              SameDiff deserialized;
              try{
                  deserialized = SameDiff.fromFlatBuffers(bbSerialized);
              } catch (IOException e){

      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 loadResource has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
      Open

          private void loadResource(Properties properties, Object name, boolean quiet) {
              try {
                  DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
                  //ignore all comments inside the xml file
                  docBuilderFactory.setIgnoringComments(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

      BidirectionalLayer has 66 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class BidirectionalLayer implements RecurrentLayer {
      
          private NeuralNetConfiguration conf;
          private Layer fwd;
          private Layer bwd;

        File BaseNativeNDArrayFactory.java has 569 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

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

          File MultiDataSet.java has 568 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

            Method mergeFrom has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
            Open

                  public Builder mergeFrom(org.nd4j.ir.TensorNamespace.TensorProto other) {
                    if (other == org.nd4j.ir.TensorNamespace.TensorProto.getDefaultInstance()) return this;
                    if (!other.dims_.isEmpty()) {
                      if (dims_.isEmpty()) {
                        dims_ = other.dims_;

            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

            FlatGraph has 65 methods (exceeds 20 allowed). Consider refactoring.
            Open

            @SuppressWarnings("unused")
            public final class FlatGraph extends Table {
              public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); }
              public static FlatGraph getRootAsFlatGraph(ByteBuffer _bb) { return getRootAsFlatGraph(_bb, new FlatGraph()); }
              public static FlatGraph getRootAsFlatGraph(ByteBuffer _bb, FlatGraph obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }

              Function onload has 237 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      fr.onload = function () {
                          var arrayBuffer = fr.result;
                          var bytes = new Uint8Array(arrayBuffer);
                          //console.log(bytes);
              
              

                File ObjectUtils.java has 560 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /*
                 *  ******************************************************************************
                 *  *
                 *  *
                 *  * This program and the accompanying materials are made available under the
                Severity: Major
                Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/io/ObjectUtils.java - About 1 day to fix

                  File GradientCheckUtil.java has 560 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

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

                    Method ffToLayerActivationsDetached has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected synchronized Map<String,INDArray> ffToLayerActivationsDetached(boolean train, @NonNull FwdPassType fwdPassType, boolean storeLastForTBPTT,
                                                                                                 int layerIndex, int[] excludeIdxs, @NonNull INDArray[] features,
                                                                                                 INDArray[] fMask, INDArray[] lMask, boolean clearLayers){
                            if(layerIndex < 0 || layerIndex >= topologicalOrder.length){
                                throw new IllegalArgumentException("Invalid layer index - index must be >= 0 and < " + topologicalOrder.length

                    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 naiveExec has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected INDArray naiveExec(ReduceOp op, long... dimension) {
                            long st = profilingConfigurableHookIn(op);
                    
                            if(op instanceof BaseReduceOp && ((BaseReduceOp)op).isEmptyReduce()) {
                                //Edge case for TF import compatibility: [x,y].reduce(empty) = [x,y]

                    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 format has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private String format(INDArray arr, int offset, boolean summarize) {
                            int rank = arr.rank();
                            if (arr.isScalar() || arr.length() == 1) {
                                int fRank = Math.min(rank, OPEN_BRACKETS.length-1);
                                if (arr.isR()) {

                    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 setValueFor has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
                    Open

                        @SneakyThrows
                        public void setValueFor(Field target, Object value) {
                            if(value == null && target.getType().isPrimitive()) {
                                throw new ND4JIllegalStateException("Unable to set primitive field " + target + " of type " + target.getClass()
                                        + " using null value!");

                    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 execute has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static Pair<List<List<Writable>>, List<List<List<Writable>>>> execute(
                                List<List<Writable>> inputWritables, List<List<List<Writable>>> inputSequence,
                                TransformProcess sequence) {
                            List<List<Writable>> currentWritables = inputWritables;
                            List<List<List<Writable>>> currentSequence = inputSequence;

                    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 IRProtobufExtensions.kt has 549 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

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

                      File auto_vect.py has 549 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      '''
                      @author : Abdelrauf rauf@konduit.ai
                      '''
                      #  /* ******************************************************************************
                      #   *
                      Severity: Major
                      Found in libnd4j/auto_vectorization/auto_vect.py - About 1 day to fix
                        Severity
                        Category
                        Status
                        Source
                        Language