deeplearning4j/deeplearning4j

View on GitHub

Showing 6,111 of 13,975 total issues

Function findLineByLeastSquares has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function findLineByLeastSquares(values_x, values_y) {
    var sum_x = 0;
    var sum_y = 0;
    var sum_xy = 0;
    var sum_xx = 0;

    Function Style has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var Style = (function () {
        function Style(jsonObj) {
            var _this = this;
            this.getWidth = function () { return _this.width; };
            this.getHeight = function () { return _this.height; };

      Consider simplifying this complex logical expression.
      Open

              if (globalType == DataType.INT32 || globalType == DataType.INT || type == DataType.INT || globalType == DataType.UINT16 || globalType == DataType.UBYTE || globalType == DataType.SHORT|| globalType == DataType.BYTE || globalType == DataType.BOOL) {
                  int anElement = element.intValue();
                  put(i, anElement);
              } else if (globalType == DataType.INT64 || globalType == DataType.LONG || type == DataType.LONG || globalType == DataType.UINT32 || globalType == DataType.UINT64) {
                  long anElement = element.longValue();

        Consider simplifying this complex logical expression.
        Open

                    if (v.getVariable().isConstant() || v.getVariable().isPlaceHolder() ||                   //Exclude constants and placeholders
                            (v.getInputsForOp() != null && !v.getInputsForOp().isEmpty()) ||                //Exclude variables that are inputs to ops
                            (v.getControlDepsForOp() != null && !v.getControlDepsForOp().isEmpty()) ||      //Exclude variables that are control dependency inputs to ops
                            (v.getControlDepsForVar() != null && !v.getControlDepsForVar().isEmpty())) {    //Exclude variables that are control dependency inputs to other variables (mainly for import of cond etc ops)
                        continue;

          Consider simplifying this complex logical expression.
          Open

                  if (df instanceof LoopCond || df instanceof Enter || df instanceof Exit || df instanceof NextIteration ||
                          df instanceof Merge || df instanceof Switch || df instanceof BaseTensorOp || df instanceof Invoke) {
                      //Control dependencies and tensor ops (like TensorArray, TensorArrayRead etc) don't need inputs set, execution is a special case
                      return new Pair<>(sdo, null);
                  }

            Consider simplifying this complex logical expression.
            Open

                    if (t == Type.REDUCE_FLOAT || t == Type.REDUCE_SAME || t == Type.REDUCE_BOOL
                            || t == Type.REDUCE_LONG || t == Type.INDEXREDUCE || t == Type.REDUCE3 || t == Type.VARIANCE || t == Type.SUMMARYSTATS) {
                        dims =  node.getDimensions() == null ? null :  new int[node.getDimensions().length];
                        //here we save longs as ints for compatibility
                        if(dims != null)

              Consider simplifying this complex logical expression.
              Open

                                  if(last != null && last.getPh() == Phase.X && te.getPh() == Phase.X &&
                                          last.getName().equals(te.getName()) &&
                                          last.getArgs() != null && te.getArgs() != null &&
                                          last.getArgs().get("name").equals(te.getArgs().get("name")) &&
                                          last.getArgs().get("op").equals(te.getArgs().get("op"))){

                Consider simplifying this complex logical expression.
                Open

                        if(currLocation >= locations.length - 1 && locations.length >= 1 && needsNewPartition() || inputSplit.needsBootstrapForWrite() ||
                                locations.length < 1 ||
                                currLocation >= locations.length || !inputSplit.canWriteToLocation(locations[currLocation])
                                && needsNewPartition()) {
                
                

                  Consider simplifying this complex logical expression.
                  Open

                                  if(lines.get(i + 1).contains("DECLARE_TYPES") ||
                                          lines.get(i + 1).contains("DECLARE_SHAPE_FN")||
                                          lines.get(i + 1).contains("DECLARE_SYN") ||
                                          lines.get(i).contains("DECLARE_TYPES") ||
                                          lines.get(i).contains("DECLARE_SHAPE_FN")||

                    Method asFile has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @Override
                        public File asFile(String resourcePath) {
                            assertExists(resourcePath);
                    
                            if (localResourceDirs != null && !localResourceDirs.isEmpty()) {

                      Method migrate has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          @Override
                          public INDArray migrate() {
                              WorkspaceUtils.assertValidArray(this, "Cannot leverage INDArray to new workspace");
                              MemoryWorkspace current = Nd4j.getMemoryManager().getCurrentWorkspace();
                      
                      

                        Method setData has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static void setData(double[] data, INDArray toSet) {
                                if (toSet.data().dataType() != DataType.DOUBLE) {
                                    throw new IllegalArgumentException("Unable to set double data for opType " + toSet.data().dataType());
                                }
                        
                        

                          Method setData has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static void setData(float[] data, INDArray toSet) {
                                  if (toSet.data().dataType() != DataType.FLOAT) {
                                      throw new IllegalArgumentException("Unable to set double data for opType " + toSet.data().dataType());
                                  }
                          
                          

                            Method offsets has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public static long[] offsets(long[] shape, INDArrayIndex... indices) {
                                    //offset of zero for every new axes
                                    long[] ret = new long[shape.length];
                            
                                    if (indices.length == shape.length) {

                              Method opInfoString has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public String opInfoString(Op op, Optional<long[]> dimensions){
                                      if(op == null)
                                          return "<NULL OP>";
                              
                                      StringBuilder sb = new StringBuilder();

                                Method mappingsForFunction has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    @Override
                                    public Map<String, Map<String, PropertyMapping>> mappingsForFunction() {
                                        Map<String,Map<String,PropertyMapping>> ret = new HashMap<>();
                                        Map<String,PropertyMapping> map = new HashMap<>();
                                
                                

                                  Method detach has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      @Override
                                      public INDArray detach() {
                                          if (!isAttached())
                                              return this;
                                  
                                  

                                    Method load has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        @Override
                                        public void load(InputStream from) {
                                            try {
                                    
                                                DataInputStream dis = from instanceof BufferedInputStream ? new DataInputStream(from)

                                      Method checkAndUpdateIfAllSatisfied has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          protected void checkAndUpdateIfAllSatisfied(@NonNull T y) {
                                      
                                              boolean allSat = isAllSatisfied(y);
                                              if (allSat) {
                                                  // Case where "x is satisfied" happened before x->y added

                                        Method eval has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            @Override
                                            public void eval(INDArray labels, INDArray predictions, INDArray mask, final List<? extends Serializable> recordMetaData) {
                                        
                                                Triple<INDArray,INDArray, INDArray> p = BaseEvaluation.reshapeAndExtractNotMasked(labels, predictions, mask, axis);
                                                if(p == null){
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language