deeplearning4j/deeplearning4j

View on GitHub

Showing 13,975 of 13,975 total issues

Method loadTxtVectors has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Deprecated
    public static WordVectors loadTxtVectors(@NonNull InputStream stream, boolean skipFirstLine) throws IOException {
        AbstractCache<VocabWord> cache = new AbstractCache.Builder<VocabWord>().build();

        BufferedReader reader = new BufferedReader(new InputStreamReader(stream));

    Method build has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public ComputationGraphConfiguration build() {
    
                ComputationGraphConfiguration conf = buildConfig();
                conf.validate(allowDisconnected, allowNoOutput); //throws exception for invalid configuration
    
    

      Method initializeConstraints has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected void initializeConstraints(Builder<?> builder) {
              //Note: this has to be done AFTER all constructors have finished - otherwise the required
              // fields may not yet be set yet
              List<LayerConstraint> allConstraints = new ArrayList<>();
              if (builder.allParamConstraints != null && !initializer().paramKeys(this).isEmpty()) {

        Method handleL1L2BackwardCompatibility has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected void handleL1L2BackwardCompatibility(BaseLayer baseLayer, ObjectNode on){
                if(on != null && (on.has("l1") || on.has("l2"))){
                    //Legacy format JSON
                    baseLayer.setRegularization(new ArrayList<Regularization>());
                    baseLayer.setRegularizationBias(new ArrayList<Regularization>());

          Method getMinibatchDivisionSubsets has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected List<INDArray> getMinibatchDivisionSubsets(INDArray from){
                  from = from.reshape(from.length());
                  List<INDArray> out = new ArrayList<>();
                  long paramsSoFar = 0;
                  long currentStart = 0;

            Method build has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public MultiLayerNetwork build() {
            
                        if (!prepDone) {
                            doPrep();
                        }

              Method pretrainLayer has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public void pretrainLayer(int layerIdx, DataSetIterator iter, int numEpochs) {
                      Preconditions.checkState(numEpochs > 0, "Number of epochs (%s) must be a positive number", numEpochs);
              
                      if (flattenedGradients == null) {
                          initGradientsView();

                Method getMergeMode has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private ElementWiseVertex.Op getMergeMode(Map<String, Object> layerConfig)
                            throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException {
                        Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
                        if (!innerConfig.containsKey(LAYER_FIELD_MODE))
                            throw new InvalidKerasConfigurationException(

                  Method createFuncAndContext has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      fun createFuncAndContext(opName: String,
                                               irGraph: IRGraph<GRAPH_TYPE, NODE_TYPE, OP_DEF_TYPE, TENSOR_TYPE, ATTR_DEF_TYPE, ATTR_VALUE_TYPE, DATA_TYPE>,
                                               opMappingRegistry: OpMappingRegistry<GRAPH_TYPE, NODE_TYPE, OP_DEF_TYPE, TENSOR_TYPE, DATA_TYPE, ATTR_DEF_TYPE, ATTR_VALUE_TYPE>,
                                               sameDiff: SameDiff,
                                               nodeName: String,

                    Function getComponent has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static getComponent(jsonStr: string): Renderable {
                    
                            var json: any = JSON.parse(jsonStr);
                            var key: string;
                            if(json["componentType"]) key = json["componentType"];  //No wrapper object case...

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

                                  @Override
                                  public boolean hasNext() {
                                      if (resetPending.get()) {
                                          if (resetSupported()) {
                                              backedIterator.reset();
                      deeplearning4j/deeplearning4j-data/deeplearning4j-utility-iterators/src/main/java/org/deeplearning4j/datasets/iterator/MultiDataSetIteratorSplitter.java on lines 187..203

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

                      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

                                  @Override
                                  public boolean hasNext() {
                                      if (resetPending.get()) {
                                          if (resetSupported()) {
                                              backedIterator.reset();
                      deeplearning4j/deeplearning4j-data/deeplearning4j-utility-iterators/src/main/java/org/deeplearning4j/datasets/iterator/DataSetIteratorSplitter.java on lines 225..241

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

                      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

                          public Map<K, V> toSingleValueMap() {
                              LinkedHashMap singleValueMap = new LinkedHashMap(this.targetMap.size());
                              Iterator i$ = this.targetMap.entrySet().iterator();
                      
                              while (i$.hasNext()) {
                      nd4j/nd4j-common/src/main/java/org/nd4j/common/io/CollectionUtils.java on lines 316..326

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

                      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

                              public Map<K, V> toSingleValueMap() {
                                  LinkedHashMap singleValueMap = new LinkedHashMap(this.map.size());
                                  Iterator i$ = this.map.entrySet().iterator();
                      
                                  while (i$.hasNext()) {
                      nd4j/nd4j-common/src/main/java/org/nd4j/common/util/LinkedMultiValueMap.java on lines 73..83

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

                      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

                          @Override
                          public int hashCode() {
                              int result = 23;
                              result = 31 * result + (allowMultipleEdges ? 1 : 0);
                              result = 31 * result + Arrays.hashCode(edges);
                      deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/sequencevectors/graph/primitives/Graph.java on lines 288..295

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

                      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

                          public static File createTempFile(String prefix, String suffix) {
                              String p = System.getProperty(ND4JSystemProperties.ND4J_TEMP_DIR_PROPERTY);
                              try {
                                  if (p == null || p.isEmpty()) {
                                      return File.createTempFile(prefix, suffix);
                      resources/src/main/java/org/deeplearning4j/common/util/ND4JFileUtils.java on lines 39..50

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

                      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

                          public static File createTempFile(String prefix, String suffix) {
                              String p = System.getProperty(DL4JSystemProperties.DL4J_TEMP_DIR_PROPERTY);
                              try {
                                  if (p == null || p.isEmpty()) {
                                      return File.createTempFile(prefix, suffix);
                      nd4j/nd4j-common/src/main/java/org/nd4j/common/util/ND4JFileUtils.java on lines 39..50

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

                      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

                          @Override
                          public int hashCode() {
                              int result = 23;
                              result = 31 * result + (allowMultipleEdges ? 1 : 0);
                              result = 31 * result + Arrays.hashCode(edges);
                      deeplearning4j/deeplearning4j-graph/src/main/java/org/deeplearning4j/graph/Graph.java on lines 249..256

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

                      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

                          public static INDArray amin(INDArray x, INDArray y, INDArray z, long... dimensions) {
                              if(dimensions == null || dimensions.length == 0  || y.isScalar()) {
                                  validateShapesNoDimCase(x,y,z);
                                  return Nd4j.getExecutioner().exec(new AMin(x,y,z));
                              }
                      nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/Broadcast.java on lines 60..67
                      nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/Broadcast.java on lines 229..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 77.

                      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

                          public static INDArray copy(INDArray x, INDArray y, INDArray z, long... dimensions) {
                              if(dimensions == null || dimensions.length == 0  || y.isScalar()) {
                                  validateShapesNoDimCase(x,y,z);
                                  return Nd4j.getExecutioner().exec(new CopyOp(x,y,z));
                              }
                      nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/Broadcast.java on lines 229..236
                      nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/Broadcast.java on lines 241..248

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language