Skip to content

Commit e328cbf

Browse files
committed
Changed Long seed to long seed.
1 parent fb52dd4 commit e328cbf

8 files changed

Lines changed: 23 additions & 37 deletions

File tree

tensorflow-framework/src/main/java/org/tensorflow/framework/initializers/Glorot.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public class Glorot<T extends TType, U extends TNumber> extends VarianceScaling<
8383
* will always produce the same random tensor for a given shape and dtype.
8484
* @see VarianceScaling.Distribution
8585
*/
86-
public Glorot(Ops tf, Distribution distribution, Long seed) {
86+
public Glorot(Ops tf, Distribution distribution, long seed) {
8787
super(tf, SCALE, Mode.FAN_AVG, distribution, seed);
8888
}
8989
}

tensorflow-framework/src/main/java/org/tensorflow/framework/initializers/He.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class He<T extends TType, U extends TNumber> extends VarianceScaling<T, U
7979
* will always produce the same random tensor for a given shape and dtype.
8080
* @see VarianceScaling.Distribution
8181
*/
82-
public He(Ops tf, Distribution distribution, Long seed) {
82+
public He(Ops tf, Distribution distribution, long seed) {
8383
super(tf, SCALE, Mode.FAN_IN, distribution, seed);
8484
}
8585
}

tensorflow-framework/src/main/java/org/tensorflow/framework/initializers/LeCun.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public class LeCun<T extends TType, U extends TNumber> extends VarianceScaling<T
8787
* @param seed the seed for random number generation. An initializer created with a given seed
8888
* will always produce the same random tensor for a given shape and dtype.
8989
*/
90-
public LeCun(Ops tf, Distribution distribution, Long seed) {
90+
public LeCun(Ops tf, Distribution distribution, long seed) {
9191
super(tf, 1.0, Mode.FAN_IN, distribution, seed);
9292
}
9393
}

tensorflow-framework/src/main/java/org/tensorflow/framework/initializers/Orthogonal.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class Orthogonal<T extends TType, U extends TNumber> extends BaseInitiali
5555
public static final double GAIN_DEFAULT = 1.0;
5656

5757
private final double gain;
58-
private final Long seed;
58+
private final long seed;
5959

6060
/**
6161
* Creates an Orthogonal Initializer using {@link #GAIN_DEFAULT} for the gain.
@@ -64,7 +64,7 @@ public class Orthogonal<T extends TType, U extends TNumber> extends BaseInitiali
6464
* @param seed the seed for random number generation. An initializer created with a given seed
6565
* will always produce the same random tensor for a given shape and dtype.
6666
*/
67-
public Orthogonal(Ops tf, Long seed) {
67+
public Orthogonal(Ops tf, long seed) {
6868
this(tf, GAIN_DEFAULT, seed);
6969
}
7070

@@ -76,7 +76,7 @@ public Orthogonal(Ops tf, Long seed) {
7676
* @param seed the seed for random number generation. An initializer created with a given seed
7777
* will always produce the same random tensor for a given shape and dtype.
7878
*/
79-
public Orthogonal(Ops tf, double gain, Long seed) {
79+
public Orthogonal(Ops tf, double gain, long seed) {
8080
super(tf);
8181
this.gain = gain;
8282
this.seed = seed;
@@ -99,8 +99,7 @@ public Operand<T> call(Operand<TInt64> dims, DataType<T> dtype) {
9999
for (; i < dimsShape.numDimensions() - 1; i++) num_rows *= dimsShape.size(i);
100100
long num_cols = dimsShape.size(i);
101101
Shape flat_shape = Shape.of(Math.max(num_rows, num_cols), Math.min(num_rows, num_cols));
102-
long lseed = this.seed == null ? 0L : this.seed;
103-
long[] seeds = {lseed, 0};
102+
long[] seeds = {seed, 0};
104103
@SuppressWarnings("unchecked")
105104
DataType<U> numdType = (DataType<U>) dtype;
106105
@SuppressWarnings("unchecked")

tensorflow-framework/src/main/java/org/tensorflow/framework/initializers/RandomNormal.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class RandomNormal<T extends TType, U extends TNumber> extends BaseInitia
4343

4444
private final double mean;
4545
private final double stddev;
46-
private final Long seed;
46+
private final long seed;
4747

4848
/**
4949
* Creates the RandomUniform initializer using {@link #MEAN_DEFAULT} for the mean and {@link
@@ -53,7 +53,7 @@ public class RandomNormal<T extends TType, U extends TNumber> extends BaseInitia
5353
* @param seed the seed for random number generation. An initializer created with a given seed
5454
* will always produce the same random tensor for a given shape and dtype.
5555
*/
56-
public RandomNormal(Ops tf, Long seed) {
56+
public RandomNormal(Ops tf, long seed) {
5757
this(tf, MEAN_DEFAULT, STDDEV_DEFAULT, seed);
5858
}
5959

@@ -65,7 +65,7 @@ public RandomNormal(Ops tf, Long seed) {
6565
* @param seed the seed for random number generation. An initializer created with a given seed
6666
* will always produce the same random tensor for a given shape and dtype.
6767
*/
68-
public RandomNormal(Ops tf, double mean, Long seed) {
68+
public RandomNormal(Ops tf, double mean, long seed) {
6969
this(tf, mean, STDDEV_DEFAULT, seed);
7070
}
7171

@@ -78,7 +78,7 @@ public RandomNormal(Ops tf, double mean, Long seed) {
7878
* @param seed the seed for random number generation. An initializer created with a given seed
7979
* will always produce the same random tensor for a given shape and dtype.
8080
*/
81-
public RandomNormal(Ops tf, double mean, double stddev, Long seed) {
81+
public RandomNormal(Ops tf, double mean, double stddev, long seed) {
8282
super(tf);
8383
this.mean = mean;
8484
this.stddev = stddev;
@@ -90,8 +90,7 @@ public RandomNormal(Ops tf, double mean, double stddev, Long seed) {
9090
public Operand<T> call(Operand<TInt64> dims, DataType<T> dtype) {
9191
if (!dtype.isNumeric())
9292
throw new IllegalArgumentException("The data type must be numeric. Found : " + dtype.name());
93-
long lseed = this.seed == null ? 0L : this.seed;
94-
long[] seeds = {lseed, 0L};
93+
long[] seeds = {seed, 0};
9594
@SuppressWarnings("unchecked")
9695
DataType<U> numdType = (DataType<U>) dtype;
9796
@SuppressWarnings("unchecked")

tensorflow-framework/src/main/java/org/tensorflow/framework/initializers/RandomUniform.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class RandomUniform<T extends TType, U extends TNumber> extends BaseIniti
4545

4646
private final Double minval;
4747
private final Double maxval;
48-
private final Long seed;
48+
private final long seed;
4949

5050
/**
5151
* Creates a RandomUniform initializer using {@link #MINVAL_DEFAULT} for the minval and
@@ -55,7 +55,7 @@ public class RandomUniform<T extends TType, U extends TNumber> extends BaseIniti
5555
* @param seed the seed for random number generation. An initializer created with a given seed
5656
* will always produce the same random tensor for a given shape and dtype.
5757
*/
58-
public RandomUniform(Ops tf, Long seed) {
58+
public RandomUniform(Ops tf, long seed) {
5959
this(tf, MINVAL_DEFAULT, MAXVAL_DEFAULT, seed);
6060
}
6161

@@ -68,7 +68,7 @@ public RandomUniform(Ops tf, Long seed) {
6868
* @param seed the seed for random number generation. An initializer created with a given seed
6969
* will always produce the same random tensor for a given shape and dtype.
7070
*/
71-
public RandomUniform(Ops tf, double minval, double maxval, Long seed) {
71+
public RandomUniform(Ops tf, double minval, double maxval, long seed) {
7272
super(tf);
7373
this.minval = minval;
7474
this.maxval = maxval;
@@ -96,9 +96,7 @@ public Operand<T> call(Operand<TInt64> dims, DataType<T> dtype) {
9696
Operand<T> distOpT = (Operand<T>) distOp;
9797
return distOpT;
9898
} else {
99-
long lseed = this.seed == null ? 0L : this.seed;
100-
long[] seeds = {lseed, 0L};
101-
99+
long[] seeds = {seed, 0};
102100
distOp = tf.random.statelessRandomUniform(dims, tf.constant(seeds), numdType);
103101
@SuppressWarnings("unchecked")
104102
Operand<T> distOpT = (Operand<T>) distOp;

tensorflow-framework/src/main/java/org/tensorflow/framework/initializers/TruncatedNormal.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class TruncatedNormal<T extends TType, U extends TNumber> extends BaseIni
4444

4545
private final double mean;
4646
private final double stddev;
47-
private final Long seed;
47+
private final long seed;
4848

4949
/**
5050
* Creates a TruncatedNormal Initializer using {@link #MEAN_DEFAULT} for the mean and {@link
@@ -54,7 +54,7 @@ public class TruncatedNormal<T extends TType, U extends TNumber> extends BaseIni
5454
* @param seed the seed for random number generation. An initializer created with a given seed
5555
* will always produce the same random tensor for a given shape and dtype.
5656
*/
57-
public TruncatedNormal(Ops tf, Long seed) {
57+
public TruncatedNormal(Ops tf, long seed) {
5858
this(tf, MEAN_DEFAULT, STDDEV_DEFAULT, seed);
5959
}
6060

@@ -67,7 +67,7 @@ public TruncatedNormal(Ops tf, Long seed) {
6767
* @param seed the seed for random number generation. An initializer created with a given seed
6868
* will always produce the same random tensor for a given shape and dtype.
6969
*/
70-
public TruncatedNormal(Ops tf, double mean, double stddev, Long seed) {
70+
public TruncatedNormal(Ops tf, double mean, double stddev, long seed) {
7171
super(tf);
7272
this.mean = mean;
7373
this.stddev = stddev;
@@ -79,8 +79,7 @@ public TruncatedNormal(Ops tf, double mean, double stddev, Long seed) {
7979
public Operand<T> call(Operand<TInt64> dims, DataType<T> dtype) {
8080
if (!dtype.isNumeric())
8181
throw new IllegalArgumentException("The data type must be numeric. Found : " + dtype.name());
82-
long lseed = this.seed == null ? 0L : this.seed;
83-
long[] seeds = {lseed, 0L};
82+
long[] seeds = {seed,0};
8483
@SuppressWarnings("unchecked")
8584
DataType<U> numdType = (DataType<U>) dtype;
8685
Operand<U> distOp = tf.random.statelessTruncatedNormal(dims, tf.constant(seeds), numdType);

tensorflow-framework/src/main/java/org/tensorflow/framework/initializers/VarianceScaling.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,8 @@ public class VarianceScaling<T extends TType, U extends TNumber> extends BaseIni
6767
private final double scale;
6868
private final Mode mode;
6969
private final Distribution distribution;
70-
private final Long seed;
70+
private final long seed;
7171

72-
/**
73-
* Creates a VarianceScaling Initializer
74-
*
75-
* @param tf the TensorFlow Ops
76-
*/
77-
public VarianceScaling(Ops tf) {
78-
this(tf, SCALE_DEFAULT, MODE_DEFAULT, DISTRIBUTION_DEFAULT, null);
79-
}
8072

8173
/**
8274
* Creates a VarianceScaling Initializer
@@ -97,7 +89,7 @@ public VarianceScaling(Ops tf, long seed) {
9789
* @param distribution Random distribution to use.
9890
* @param seed Used to create random seeds.
9991
*/
100-
public VarianceScaling(Ops tf, double scale, Mode mode, Distribution distribution, Long seed) {
92+
public VarianceScaling(Ops tf, double scale, Mode mode, Distribution distribution, long seed) {
10193
super(tf);
10294
if (scale <= 0.0) {
10395
throw new IllegalArgumentException("scale must be greater than 0, got " + scale);
@@ -133,8 +125,7 @@ public Operand<T> call(Operand<TInt64> dims, DataType<T> dtype) {
133125
@SuppressWarnings("unchecked")
134126
DataType<U> numdType = (DataType<U>) dtype;
135127
double stddev;
136-
long lseed = this.seed == null ? 0L : this.seed;
137-
long[] seeds = {lseed, 0L};
128+
long[] seeds = {seed, 0};
138129
switch (distribution) {
139130
case TRUNCATED_NORMAL:
140131
distOp = tf.random.statelessTruncatedNormal(dims, tf.constant(seeds), numdType);

0 commit comments

Comments
 (0)