Skip to content

Commit a585c81

Browse files
treoAlexDBlack
authored andcommitted
Deprecate Backprop and Pretrain options when configuring ComputationGraph and MultiLayer (deeplearning4j#6296)
* Deprecate Backprop and Pretrain options when configuring ComputationGraph and MultiLayer * Deprecate Backprop and Pretrain options when configuring ComputationGraph and MultiLayer
1 parent 75b7039 commit a585c81

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/ComputationGraphConfiguration.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@
2828
import org.deeplearning4j.nn.conf.layers.samediff.SameDiffVertex;
2929
import org.deeplearning4j.nn.conf.memory.MemoryReport;
3030
import org.deeplearning4j.nn.conf.memory.NetworkMemoryReport;
31-
import org.deeplearning4j.nn.layers.samediff.SameDiffGraphVertex;
3231
import org.nd4j.base.Preconditions;
3332
import org.nd4j.linalg.activations.Activation;
3433
import org.nd4j.linalg.activations.IActivation;
34+
import org.nd4j.linalg.dataset.api.MultiDataSet;
35+
import org.nd4j.linalg.dataset.api.iterator.DataSetIterator;
3536
import org.nd4j.shade.jackson.databind.JsonNode;
3637
import org.nd4j.shade.jackson.databind.ObjectMapper;
3738
import org.slf4j.Logger;
@@ -597,7 +598,9 @@ public static class GraphBuilder {
597598
protected List<InputType> networkInputTypes = new ArrayList<>();
598599
protected List<String> networkOutputs = new ArrayList<>();
599600

601+
@Deprecated
600602
protected boolean pretrain = false;
603+
@Deprecated
601604
protected boolean backprop = true;
602605
protected BackpropType backpropType = BackpropType.Standard;
603606
protected int tbpttFwdLength = DEFAULT_TBPTT_LENGTH;
@@ -649,8 +652,11 @@ public GraphBuilder inputPreProcessor(String layer, InputPreProcessor processor)
649652
/**
650653
* Whether to do back prop (standard supervised learning) or not
651654
*
655+
* @deprecated doesn't affect training any more. Use {@link org.deeplearning4j.nn.graph.ComputationGraph#fit(MultiDataSet)} when training for backprop.
656+
*
652657
* @param backprop whether to do back prop or not
653658
*/
659+
@Deprecated
654660
public GraphBuilder backprop(boolean backprop) {
655661
this.backprop = backprop;
656662
return this;
@@ -659,8 +665,11 @@ public GraphBuilder backprop(boolean backprop) {
659665
/**
660666
* Whether to do layerwise pre training or not
661667
*
668+
* @deprecated doesn't affect training any more. Use {@link org.deeplearning4j.nn.graph.ComputationGraph#pretrain(MultiDataSetIterator)} when training for layerwise pretraining.
669+
*
662670
* @param pretrain whether to do pre train or not
663671
*/
672+
@Deprecated
664673
public GraphBuilder pretrain(boolean pretrain) {
665674
this.pretrain = pretrain;
666675
return this;

deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/MultiLayerConfiguration.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.deeplearning4j.nn.conf.memory.LayerMemoryReport;
2626
import org.deeplearning4j.nn.conf.memory.MemoryReport;
2727
import org.deeplearning4j.nn.conf.memory.NetworkMemoryReport;
28-
import org.deeplearning4j.nn.layers.AbstractLayer;
2928
import org.nd4j.linalg.activations.Activation;
3029
import org.nd4j.linalg.activations.IActivation;
3130
import org.nd4j.linalg.factory.Nd4j;
@@ -389,7 +388,9 @@ public static class Builder {
389388
protected List<NeuralNetConfiguration> confs = new ArrayList<>();
390389
protected double dampingFactor = 100;
391390
protected Map<Integer, InputPreProcessor> inputPreProcessors = new HashMap<>();
391+
@Deprecated
392392
protected boolean pretrain = false;
393+
@Deprecated
393394
protected boolean backprop = true;
394395
protected BackpropType backpropType = BackpropType.Standard;
395396
protected int tbpttFwdLength = DEFAULT_TBPTT_LENGTH;
@@ -419,9 +420,13 @@ public Builder inputPreProcessors(Map<Integer, InputPreProcessor> processors) {
419420

420421
/**
421422
* Whether to do back prop or not
423+
*
424+
* @deprecated doesn't affect training any more. Use {@link org.deeplearning4j.nn.multilayer.MultiLayerNetwork#fit(DataSetIterator)} when training for backprop.
425+
*
422426
* @param backprop whether to do back prop or not
423427
* @return
424428
*/
429+
@Deprecated
425430
public Builder backprop(boolean backprop) {
426431
this.backprop = backprop;
427432
return this;
@@ -506,9 +511,13 @@ public Builder tBPTTBackwardLength(int backwardLength) {
506511

507512
/**
508513
* Whether to do pre train or not
514+
*
515+
* @deprecated doesn't affect training any more. Use {@link org.deeplearning4j.nn.multilayer.MultiLayerNetwork#pretrain(DataSetIterator)} when training for layerwise pretraining.
516+
*
509517
* @param pretrain whether to do pre train or not
510518
* @return builder pattern
511519
*/
520+
@Deprecated
512521
public Builder pretrain(boolean pretrain) {
513522
this.pretrain = pretrain;
514523
return this;

0 commit comments

Comments
 (0)