Skip to content

Commit 505d0d6

Browse files
committed
Change snake case to camel case
1 parent b0b747e commit 505d0d6

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,24 @@ public Operand<T> call(Operand<TInt64> dims, DataType<T> dtype) {
7575
throw new IllegalArgumentException("2D matrix required, got " + shape.numDimensions());
7676
}
7777
boolean isSquare = shape.size(0) == shape.size(1);
78-
long diag_size = Math.min(shape.size(0), shape.size(1));
79-
Shape diagShape = Shape.of(diag_size);
78+
long diagSize = Math.min(shape.size(0), shape.size(1));
79+
Shape diagShape = Shape.of(diagSize);
8080

8181
Operand<T> op;
8282
Operand<T> zero = tf.dtypes.cast(tf.constant(0), dtype);
83-
Operand<T> diag_ones =
83+
Operand<T> diagOnes =
8484
tf.fill(tf.constant(diagShape.asArray()), tf.dtypes.cast(tf.constant(1.0), dtype));
8585
if (isSquare) {
8686
op =
8787
tf.linalg.matrixDiag(
88-
diag_ones,
88+
diagOnes,
8989
tf.constant(0), // don't cast here, expecting TInt32
9090
tf.constant((int) shape.size(0)),
9191
tf.constant((int) shape.size(1)),
9292
zero);
9393
} else {
94-
Operand<T> zero_matrix = tf.zeros(dims, dtype);
95-
op = tf.linalg.matrixSetDiag(zero_matrix, diag_ones, tf.constant(0));
94+
Operand<T> zeroMatrix = tf.zeros(dims, dtype);
95+
op = tf.linalg.matrixSetDiag(zeroMatrix, diagOnes, tf.constant(0));
9696
}
9797

9898
return tf.math.mul(op, tf.dtypes.cast(tf.constant(gain), dtype));

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,18 @@ public Operand<T> call(Operand<TInt64> dims, DataType<T> dtype) {
9494
"The tensor to initialize must be at least two-dimensional, got "
9595
+ dimsShape.numDimensions());
9696
}
97-
long num_rows = 1;
97+
long numRows = 1;
9898
int i = 0;
99-
for (; i < dimsShape.numDimensions() - 1; i++) num_rows *= dimsShape.size(i);
100-
long num_cols = dimsShape.size(i);
101-
Shape flat_shape = Shape.of(Math.max(num_rows, num_cols), Math.min(num_rows, num_cols));
99+
for (; i < dimsShape.numDimensions() - 1; i++) numRows *= dimsShape.size(i);
100+
long numCols = dimsShape.size(i);
101+
Shape flatShape = Shape.of(Math.max(numRows, numCols), Math.min(numRows, numCols));
102102
long[] seeds = {seed, 0};
103103
@SuppressWarnings("unchecked")
104104
DataType<U> numdType = (DataType<U>) dtype;
105105
@SuppressWarnings("unchecked")
106106
Operand<T> op =
107107
(Operand<T>)
108-
tf.random.statelessRandomNormal(tf.constant(flat_shape), tf.constant(seeds), numdType);
108+
tf.random.statelessRandomNormal(tf.constant(flatShape), tf.constant(seeds), numdType);
109109

110110
Qr.Options qrOptions = Qr.fullMatrices(false);
111111
Qr<T> qrOp = tf.linalg.qr(op, qrOptions);
@@ -114,7 +114,7 @@ public Operand<T> call(Operand<TInt64> dims, DataType<T> dtype) {
114114
Operand<T> diagOp =
115115
tf.linalg.matrixDiagPart(ro, tf.constant(0), tf.dtypes.cast(tf.constant(0), dtype));
116116
Operand<T> qop = tf.math.mul(qo, tf.math.sign(diagOp));
117-
if (num_rows < num_cols) qop = tf.linalg.transpose(qop, null);
117+
if (numRows < numCols) qop = tf.linalg.transpose(qop, null);
118118

119119
return tf.math.mul(qop, tf.dtypes.cast(tf.constant(this.gain), dtype));
120120
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,12 @@ private double[] computeFans(Shape shape) {
166166
fanIn = dims[0];
167167
fanOut = dims[1];
168168
} else {
169-
double receptive_field_size = 1.;
169+
double receptiveFieldSize = 1.;
170170
for (int i = dims.length - 2; i >= 0; i--) {
171-
receptive_field_size *= dims[i];
171+
receptiveFieldSize *= dims[i];
172172
}
173-
fanIn = dims[dims.length - 2] * receptive_field_size;
174-
fanOut = dims[dims.length - 1] * receptive_field_size;
173+
fanIn = dims[dims.length - 2] * receptiveFieldSize;
174+
fanOut = dims[dims.length - 1] * receptiveFieldSize;
175175
}
176176

177177
return new double[] {fanIn, fanOut};

0 commit comments

Comments
 (0)