Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue fix 1773 and 1774 #1789

Merged
merged 5 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions api/src/main/java/ai/djl/ndarray/NDArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,11 @@ default void set(NDIndex index, Function<NDArray, NDArray> function) {
/**
* Sets the {@code NDArray} by boolean mask.
*
* @param index the boolean {@code NDArray} that indicates what to get
* @param index the boolean or integer {@code NDArray} that indicates what to get
* @param value the value to replace with
*/
default void set(NDArray index, Number value) {
set(new NDIndex().addBooleanIndex(index), value);
set(new NDIndex("{}", index), value);
}

/**
Expand Down Expand Up @@ -526,7 +526,7 @@ default NDArray get(NDManager manager, NDIndex index) {
/**
* Returns a partial {@code NDArray}.
*
* @param index the boolean or int {@code NDArray} that indicates what to get
* @param index the boolean or integer {@code NDArray} that indicates what to get
* @return the partial {@code NDArray}
*/
default NDArray get(NDArray index) {
Expand Down
4 changes: 2 additions & 2 deletions docs/get.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ If you have another project and want to use a custom version of DJL in it, you c

```groovy
dependencies {
implementation platform("ai.djl:bom:0.17.0-SNAPSHOT")
implementation platform("ai.djl:bom:<UPCOMING VERSION>-SNAPSHOT")
KexinFeng marked this conversation as resolved.
Show resolved Hide resolved
}
```

This snapshot version is the same as the custom DJL repository.

You also need to change directory to `djl/bom`. Then build and publish it to maven local same as was done in `djl`.
You also need to change directory to `djl/bom`. Then build and publish it to maven local same as what was done in `djl`.

From there, you may have to update the Maven or Gradle build of the project importing DJL to also look at the local maven repository cache for your locally published versions of DJL. For Maven, no changes are necessary. If you are using Gradle, you will have to add the maven local repository such as this [example](https://github.com/deepjavalibrary/djl-demo/blob/135c969d66d98d1672852e53a37e52ca1da3e325/pneumonia-detection/build.gradle#L11):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,13 @@ public void testSetNumber() {
expected =
manager.create(new int[] {666, 666, 3, 666, 666, 6, 7, 8, 9}, new Shape(3, 3));
Assert.assertEquals(original, expected);

original = manager.arange(1, 10).reshape(3, 3);
original.set(index, 666);
expected =
manager.create(
new int[] {666, 666, 666, 666, 666, 666, 7, 8, 9}, new Shape(3, 3));
Assert.assertEquals(original, expected);
}
}

Expand Down