Skip to content

Commit

Permalink
Fixes java23 compile error (#3556)
Browse files Browse the repository at this point in the history
* Fixes java23 compile error

* Fix flag
  • Loading branch information
xyang16 authored Dec 17, 2024
1 parent 6e5a9b0 commit 77d2ded
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 39 deletions.
34 changes: 16 additions & 18 deletions api/src/main/java/ai/djl/ndarray/NDArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -1016,15 +1016,13 @@ default NDArray like() {
return getManager().create(getShape());
}

////////////////////////////////////////
////////////////////////////////////////
/*
// Operations
////////////////////////////////////////
////////////////////////////////////////
*/

////////////////////////////////////////
/*
// Operations: Element Comparison
////////////////////////////////////////
*/

/**
* Returns {@code true} if all elements in this {@code NDArray} are equal to the {@link Number}.
Expand Down Expand Up @@ -1375,9 +1373,9 @@ default boolean allClose(NDArray other, double rtol, double atol, boolean equalN
*/
NDArray lte(NDArray other);

////////////////////////////////////////
/*
// Operations: Element Arithmetic
////////////////////////////////////////
*/

/**
* Adds a number to this {@code NDArray} element-wise.
Expand Down Expand Up @@ -2006,9 +2004,9 @@ default boolean allClose(NDArray other, double rtol, double atol, boolean equalN
*/
NDArray minimum(NDArray other);

////////////////////////////////////////
/*
// Operations: Basic Numeric
////////////////////////////////////////
*/

/**
* Returns the numerical negative {@code NDArray} element-wise.
Expand Down Expand Up @@ -2516,9 +2514,9 @@ default boolean allClose(NDArray other, double rtol, double atol, boolean equalN
*/
NDArray toRadians();

////////////////////////////////////////
/*
// Operations: Reduction
////////////////////////////////////////
*/

/**
* Returns the maximum of this {@code NDArray}.
Expand Down Expand Up @@ -3161,9 +3159,9 @@ default NDArray trace(int offset) {
*/
NDArray trace(int offset, int axis1, int axis2);

////////////////////////////////////////
/*
// Operations: Shapes and Arrays Manipulation
////////////////////////////////////////
*/

/**
* Splits this {@code NDArray} into multiple sub{@code NDArray}s given sections along first
Expand Down Expand Up @@ -3885,9 +3883,9 @@ default NDArray concat(NDArray array, int axis) {
return getNDArrayInternal().concat(new NDList(array), axis);
}

////////////////////////////////////////
/*
// Operations: Logical Op
////////////////////////////////////////
*/

/**
* Returns the truth value of this {@code NDArray} AND the other {@code NDArray} element-wise.
Expand Down Expand Up @@ -4010,9 +4008,9 @@ default NDArray concat(NDArray array, int axis) {
*/
NDArray logicalNot();

////////////////////////////////////////
/*
// Operations: Other
////////////////////////////////////////
*/

/**
* Returns the indices that would sort this {@code NDArray}.
Expand Down
8 changes: 4 additions & 4 deletions api/src/main/java/ai/djl/ndarray/NDArrays.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ private static void checkInputs(NDArray[] arrays) {
}
}

////////////////////////////////////////
/*
// Operations: Element Comparison
////////////////////////////////////////
*/

/**
* Returns {@code true} if all elements in {@link NDArray} a are equal to {@link NDArray} b.
Expand Down Expand Up @@ -788,9 +788,9 @@ public static NDArray sequenceMask(NDArray data, NDArray sequenceLength) {
return data.sequenceMask(sequenceLength);
}

////////////////////////////////////////
/*
// Operations: Element Arithmetic
////////////////////////////////////////
*/

/**
* Adds a number to the {@link NDArray} element-wise.
Expand Down
28 changes: 14 additions & 14 deletions api/src/main/java/ai/djl/ndarray/internal/NDArrayEx.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
@SuppressWarnings("MissingJavadocMethod")
public interface NDArrayEx {

////////////////////////////////////////
/*
// NDArrays
////////////////////////////////////////
*/

/**
* Applies reverse division with a scalar - i.e., (n / thisArrayValues).
Expand Down Expand Up @@ -144,9 +144,9 @@ public interface NDArrayEx {
*/
NDArray rpowi(Number n);

////////////////////////////////////////
/*
// Activations
////////////////////////////////////////
*/

/**
* Computes rectified linear activation.
Expand Down Expand Up @@ -179,9 +179,9 @@ default NDArray mish() {
return getArray().exp().add(1).log2().tanh().mul(getArray());
}

////////////////////////////////////////
/*
// Pooling Operations
////////////////////////////////////////
*/

NDArray maxPool(Shape kernelShape, Shape stride, Shape padding, boolean ceilMode);

Expand All @@ -201,9 +201,9 @@ NDArray lpPool(

NDArray globalLpPool(float normType);

////////////////////////////////////////
/*
// Optimizer
////////////////////////////////////////
*/

void adadeltaUpdate(
NDList inputs,
Expand Down Expand Up @@ -268,9 +268,9 @@ void sgdUpdate(
float momentum,
boolean lazyUpdate);

////////////////////////////////////////
/*
// Neural network
////////////////////////////////////////
*/

NDList convolution(
NDArray input,
Expand Down Expand Up @@ -398,9 +398,9 @@ NDList lstm(
boolean bidirectional,
boolean batchFirst);

////////////////////////////////////////
/*
// Image and CV
////////////////////////////////////////
*/

/**
* Normalizes a NDArray of shape CHW or NCHW with mean and standard deviation.
Expand Down Expand Up @@ -489,9 +489,9 @@ default NDArray crop(int x, int y, int width, int height) {
// TODO: add TorchVision support
NDArray randomColorJitter(float brightness, float contrast, float saturation, float hue);

////////////////////////////////////////
/*
// Miscellaneous
////////////////////////////////////////
*/

/**
* Returns an {@link NDArrayIndexer}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.List;

/** {@code MxNDArrayEx} is the MXNet implementation of the {@link NDArrayEx}. */
@SuppressWarnings("dangling-doc-comments")
class MxNDArrayEx implements NDArrayEx {

private MxNDArray array;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
/**
* A class containing utilities to interact with the MXNet Engine's Java Native Access (JNA) layer.
*/
@SuppressWarnings("MissingJavadocMethod")
@SuppressWarnings({"MissingJavadocMethod", "dangling-doc-comments"})
public final class JnaUtils {

public static final ObjectPool<PointerByReference> REFS =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/

/** A class holds character span information. */
package ai.djl.huggingface.tokenizers.jni;

/** A class holds character span information. */
Expand Down

0 comments on commit 77d2ded

Please sign in to comment.