deeplearning4j/deeplearning4j

View on GitHub

Showing 6,111 of 13,975 total issues

File ArgDescriptorParserUtils.java has 651 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Function ChartTimeline has 290 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function ChartTimeline(jsonStr) {
            var _this = _super.call(this, ComponentType.ChartTimeline, jsonStr) || this;
            _this.render = function (appendToObject) {
                var instance = _this;
                var s = _this.getStyle();

      Method computeArrays has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
      Open

          public void computeArrays() {
              if(sameDiff.isEagerMode()) {
                  SDVariable[] args = args();
                  if(inputArguments.isEmpty()) {
                      for (SDVariable arg : args) {

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

          @Override
          public INDArray get(INDArrayIndex... indexes) {
              Nd4j.getCompressor().autoDecompress(this);
              INDArrayIndex[] originalIndices = indexes;
              //copy to avoid direct modification

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

          @Override
          public DataSet next(int num) {
              if (sentenceProvider == null) {
                  throw new UnsupportedOperationException("Cannot do next/hasNext without a sentence provider");
              }

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

          protected Pair<Gradient, INDArray> calcBackpropGradients(INDArray epsilon, boolean withOutputLayer, boolean tbptt,
                                                                   boolean returnInputActGrad) {
              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

      DataSet has 77 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public interface DataSet extends Iterable<org.nd4j.linalg.dataset.DataSet>, Serializable {
      
      
          DataSet getRange(int from, int to);
      
      

        File MathUtils.java has 645 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/util/MathUtils.java - About 1 day to fix

          Method alloc has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public PagedPointer alloc(long requiredMemory, MemoryKind kind, DataType type, boolean initialize) {
                  long numElements = requiredMemory / Nd4j.sizeOfDataType(type);
          
                  // alignment

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

              public INDArray exec(ReduceOp op, OpContext oc) {
                  INDArray x = getX(op, oc);
                  INDArray y = getY(op, oc);
                  INDArray z = getZ(op, oc);
                  Preconditions.checkNotNull(x, "Op.x() cannot be null: Was null for op %s", op);

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

              Pair<Map<String, KerasLayer>, List<KerasLayer>> prepareLayers(List<Object> layerConfigs)
                      throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException {
                  Map<String, KerasLayer> layers = new HashMap<>(); // map from layer name to KerasLayer
                  List<KerasLayer> layersOrdered = new ArrayList<>();
          
          

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

              @Override
              public byte[] asBytes() {
                  //NOTE: DataOutputStream is big endian
                  ByteArrayOutputStream bos = new ByteArrayOutputStream();
                  DataOutputStream dos = new DataOutputStream(bos);

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

              public void renameVariable(SameDiffOp opToReName,String from, String to) {
                  if(!variables.containsKey(from)) {
                      System.out.println(String.format("Failed to rename variable %s to %s, no variable found",from,to));
                      return;
                  }

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

              public SDVariable get(SDIndex... indices) {
                  int ndims = indices.length;
                  boolean variableIndices = false;
                  //copy because we can mutate this internally
                  SDIndex[] inputIndices = Arrays.copyOf(indices,indices.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 updateDescendantDeps has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
          Open

              protected void updateDescendantDeps(ExecStep justExecuted, FrameIter outFrameIter) {
                  ExecType t = justExecuted.getType();
                  String n = justExecuted.getName();
                  if (justExecuted.getType() == ExecType.OP) {
                      SameDiffOp op = sameDiff.getOps().get(n);

          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

          MappingRuleOrBuilder has 75 methods (exceeds 20 allowed). Consider refactoring.
          Open

            public interface MappingRuleOrBuilder extends
                // @@protoc_insertion_point(interface_extends:org.nd4j.ir.MappingRule)
                org.nd4j.shade.protobuf.MessageOrBuilder {
          
              /**

            UpdateEncoder has 75 methods (exceeds 20 allowed). Consider refactoring.
            Open

            @javax.annotation.Generated(value = {"org.deeplearning4j.ui.stats.sbe.UpdateEncoder"})
            @SuppressWarnings("all")
            public class UpdateEncoder {
                public static final int BLOCK_LENGTH = 32;
                public static final int TEMPLATE_ID = 2;

              File ConvolutionUtils.java has 631 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

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

                Method asFlatNode has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static int asFlatNode(@NonNull SameDiff sameDiff, @NonNull DifferentialFunction node, @NonNull FlatBufferBuilder bufferBuilder, List<SDVariable> variables,
                                                 Map<String, Integer> reverseMap, Map<String, Integer> forwardMap, Map<String, Integer> framesMap, AtomicInteger idCounter, Integer id) {
                        val opName = node.opName();
                        val hash = FlatBuffersMapper.getOpNum(node.opName(), node.opType());
                
                

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

                    public INDArray preOutput(INDArray x, TrainingMode training, LayerWorkspaceMgr workspaceMgr) {
                        int dim = 1;
                        INDArray originalInput = x;
                        boolean rnnInput = false;
                        //RNN input

                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