diff --git a/ndarray/src/main/java/org/tensorflow/ndarray/impl/sparse/BooleanSparseNdArray.java b/ndarray/src/main/java/org/tensorflow/ndarray/impl/sparse/BooleanSparseNdArray.java index f9e41bf..f5b984f 100644 --- a/ndarray/src/main/java/org/tensorflow/ndarray/impl/sparse/BooleanSparseNdArray.java +++ b/ndarray/src/main/java/org/tensorflow/ndarray/impl/sparse/BooleanSparseNdArray.java @@ -63,7 +63,7 @@ public class BooleanSparseNdArray extends AbstractSparseNdArray implements ByteNdArray { /** - * Creates a ByteSparseNdArray + * Creates a ByteSparseNdArray with a default value of zero. * * @param indices A 2-D LongNdArray of shape {@code [N, ndims]}, that specifies the indices of the * elements in the sparse array that contain non-default values (elements are zero-indexed). @@ -73,14 +73,16 @@ public class ByteSparseNdArray extends AbstractSparseNdArray * each element in indices. For example, given {@code indices=[[1,3], [2,4]]}, the parameter * {@code values=[18, 3.6]} specifies that element {@code [1,3]} of the sparse NdArray has a * value of {@code 18}, and element {@code [2,4]} of the NdArray has a value of {@code 3.6}. + * @param defaultValue Scalar value to set for indices not specified in {@link #getIndices()} * @param dimensions the dimensional space for the dense object represented by this sparse array, */ - ByteSparseNdArray(LongNdArray indices, ByteNdArray values, DimensionalSpace dimensions) { - this(indices, values, (byte) 0, dimensions); + protected ByteSparseNdArray( + LongNdArray indices, ByteNdArray values, byte defaultValue, DimensionalSpace dimensions) { + super(indices, values, defaultValue, dimensions); } /** - * Creates a ByteSparseNdArray with a default value of zero. + * Creates a ByteSparseNdArray * * @param indices A 2-D LongNdArray of shape {@code [N, ndims]}, that specifies the indices of the * elements in the sparse array that contain non-default values (elements are zero-indexed). @@ -90,12 +92,10 @@ public class ByteSparseNdArray extends AbstractSparseNdArray * each element in indices. For example, given {@code indices=[[1,3], [2,4]]}, the parameter * {@code values=[18, 3.6]} specifies that element {@code [1,3]} of the sparse NdArray has a * value of {@code 18}, and element {@code [2,4]} of the NdArray has a value of {@code 3.6}. - * @param defaultValue Scalar value to set for indices not specified in {@link #getIndices()} * @param dimensions the dimensional space for the dense object represented by this sparse array, */ - ByteSparseNdArray( - LongNdArray indices, ByteNdArray values, byte defaultValue, DimensionalSpace dimensions) { - super(indices, values, defaultValue, dimensions); + ByteSparseNdArray(LongNdArray indices, ByteNdArray values, DimensionalSpace dimensions) { + this(indices, values, (byte) 0, dimensions); } /** diff --git a/ndarray/src/main/java/org/tensorflow/ndarray/impl/sparse/DoubleSparseNdArray.java b/ndarray/src/main/java/org/tensorflow/ndarray/impl/sparse/DoubleSparseNdArray.java index 27a0832..07a6d2a 100644 --- a/ndarray/src/main/java/org/tensorflow/ndarray/impl/sparse/DoubleSparseNdArray.java +++ b/ndarray/src/main/java/org/tensorflow/ndarray/impl/sparse/DoubleSparseNdArray.java @@ -63,7 +63,7 @@ public class DoubleSparseNdArray extends AbstractSparseNdArray implements IntNdArray { /** - * Creates a IntSparseNdArray with a default value of zero. + * Creates a IntSparseNdArray * * @param indices A 2-D LongNdArray of shape {@code [N, ndims]}, that specifies the indices of the * elements in the sparse array that contain non-default values (elements are zero-indexed). @@ -73,14 +73,16 @@ public class IntSparseNdArray extends AbstractSparseNdArray * in indices. For example, given {@code indices=[[1,3], [2,4]]}, the parameter {@code * values=[18, 3.6]} specifies that element {@code [1,3]} of the sparse NdArray has a value of * {@code 18}, and element {@code [2,4]} of the NdArray has a value of {@code 3.6}. + * @param defaultValue Scalar value to set for indices not specified in {@link #getIndices()} * @param dimensions the dimensional space for the dense object represented by this sparse array, */ - IntSparseNdArray(LongNdArray indices, IntNdArray values, DimensionalSpace dimensions) { - this(indices, values, 0, dimensions); + protected IntSparseNdArray( + LongNdArray indices, IntNdArray values, int defaultValue, DimensionalSpace dimensions) { + super(indices, values, defaultValue, dimensions); } /** - * Creates a IntSparseNdArray + * Creates a IntSparseNdArray with a default value of zero. * * @param indices A 2-D LongNdArray of shape {@code [N, ndims]}, that specifies the indices of the * elements in the sparse array that contain non-default values (elements are zero-indexed). @@ -90,12 +92,10 @@ public class IntSparseNdArray extends AbstractSparseNdArray * in indices. For example, given {@code indices=[[1,3], [2,4]]}, the parameter {@code * values=[18, 3.6]} specifies that element {@code [1,3]} of the sparse NdArray has a value of * {@code 18}, and element {@code [2,4]} of the NdArray has a value of {@code 3.6}. - * @param defaultValue Scalar value to set for indices not specified in {@link #getIndices()} * @param dimensions the dimensional space for the dense object represented by this sparse array, */ - IntSparseNdArray( - LongNdArray indices, IntNdArray values, int defaultValue, DimensionalSpace dimensions) { - super(indices, values, defaultValue, dimensions); + IntSparseNdArray(LongNdArray indices, IntNdArray values, DimensionalSpace dimensions) { + this(indices, values, 0, dimensions); } /** diff --git a/ndarray/src/main/java/org/tensorflow/ndarray/impl/sparse/LongSparseNdArray.java b/ndarray/src/main/java/org/tensorflow/ndarray/impl/sparse/LongSparseNdArray.java index 3385022..242ba50 100644 --- a/ndarray/src/main/java/org/tensorflow/ndarray/impl/sparse/LongSparseNdArray.java +++ b/ndarray/src/main/java/org/tensorflow/ndarray/impl/sparse/LongSparseNdArray.java @@ -62,7 +62,7 @@ public class LongSparseNdArray extends AbstractSparseNdArray implements LongNdArray { /** - * Creates a LongSparseNdArray with a default value of zero. + * Creates a LongSparseNdArray * * @param indices A 2-D LongNdArray of shape {@code [N, ndims]}, that specifies the indices of the * elements in the sparse array that contain non-default values (elements are zero-indexed). @@ -72,14 +72,16 @@ public class LongSparseNdArray extends AbstractSparseNdArray * element in indices. For example, given {@code indices=[[1,3], [2,4]]}, the parameter {@code * values=[18, 3.6]} specifies that element {@code [1,3]} of the sparse NdArray has a value of * {@code 18}, and element {@code [2,4]} of the NdArray has a value of {@code 3.6}. + * @param defaultValue Scalar value to set for indices not specified in {@link #getIndices()} * @param dimensions the dimensional space for the dense object represented by this sparse array, */ - LongSparseNdArray(LongNdArray indices, LongNdArray values, DimensionalSpace dimensions) { - this(indices, values, 0L, dimensions); + protected LongSparseNdArray( + LongNdArray indices, LongNdArray values, long defaultValue, DimensionalSpace dimensions) { + super(indices, values, defaultValue, dimensions); } /** - * Creates a LongSparseNdArray + * Creates a LongSparseNdArray with a default value of zero. * * @param indices A 2-D LongNdArray of shape {@code [N, ndims]}, that specifies the indices of the * elements in the sparse array that contain non-default values (elements are zero-indexed). @@ -89,12 +91,10 @@ public class LongSparseNdArray extends AbstractSparseNdArray * element in indices. For example, given {@code indices=[[1,3], [2,4]]}, the parameter {@code * values=[18, 3.6]} specifies that element {@code [1,3]} of the sparse NdArray has a value of * {@code 18}, and element {@code [2,4]} of the NdArray has a value of {@code 3.6}. - * @param defaultValue Scalar value to set for indices not specified in {@link #getIndices()} * @param dimensions the dimensional space for the dense object represented by this sparse array, */ - LongSparseNdArray( - LongNdArray indices, LongNdArray values, long defaultValue, DimensionalSpace dimensions) { - super(indices, values, defaultValue, dimensions); + LongSparseNdArray(LongNdArray indices, LongNdArray values, DimensionalSpace dimensions) { + this(indices, values, 0L, dimensions); } /** diff --git a/ndarray/src/main/java/org/tensorflow/ndarray/impl/sparse/ShortSparseNdArray.java b/ndarray/src/main/java/org/tensorflow/ndarray/impl/sparse/ShortSparseNdArray.java index 50793b9..63dde22 100644 --- a/ndarray/src/main/java/org/tensorflow/ndarray/impl/sparse/ShortSparseNdArray.java +++ b/ndarray/src/main/java/org/tensorflow/ndarray/impl/sparse/ShortSparseNdArray.java @@ -63,7 +63,7 @@ public class ShortSparseNdArray extends AbstractSparseNdArray> extends AbstractSparseNdArra private final Class type; /** - * Creates a SparseNdArray with a default value of null. + * Creates a SparseNdArray * * @param indices A 2-D LongNdArray of shape {@code [N, ndims]}, that specifies the indices of the * elements in the sparse array that contain non-default values (elements are zero-indexed). @@ -74,14 +74,17 @@ public class SparseNdArray> extends AbstractSparseNdArra * parameter {@code values=[18, 3.6]} specifies that element {@code [1,3]} of the sparse * NdArray has a value of {@code 18}, and element {@code [2,4]} of the NdArray has a value of * {@code 3.6}. + * @param defaultValue Scalar value to set for indices not specified in {@link #getIndices()} * @param dimensions the dimensional space for the dense object represented by this sparse array, */ - SparseNdArray(Class type, LongNdArray indices, U values, DimensionalSpace dimensions) { - this(type, indices, values, null, dimensions); + protected SparseNdArray( + Class type, LongNdArray indices, U values, T defaultValue, DimensionalSpace dimensions) { + super(indices, values, defaultValue, dimensions); + this.type = type; } /** - * Creates a SparseNdArray + * Creates a SparseNdArray with a default value of null. * * @param indices A 2-D LongNdArray of shape {@code [N, ndims]}, that specifies the indices of the * elements in the sparse array that contain non-default values (elements are zero-indexed). @@ -92,13 +95,10 @@ public class SparseNdArray> extends AbstractSparseNdArra * parameter {@code values=[18, 3.6]} specifies that element {@code [1,3]} of the sparse * NdArray has a value of {@code 18}, and element {@code [2,4]} of the NdArray has a value of * {@code 3.6}. - * @param defaultValue Scalar value to set for indices not specified in {@link #getIndices()} * @param dimensions the dimensional space for the dense object represented by this sparse array, */ - SparseNdArray( - Class type, LongNdArray indices, U values, T defaultValue, DimensionalSpace dimensions) { - super(indices, values, defaultValue, dimensions); - this.type = type; + SparseNdArray(Class type, LongNdArray indices, U values, DimensionalSpace dimensions) { + this(type, indices, values, null, dimensions); } /**