Skip to content

Commit

Permalink
Changing format and updating doc
Browse files Browse the repository at this point in the history
  • Loading branch information
markbookk committed Apr 19, 2021
1 parent ace3887 commit 601bd15
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion api/src/main/java/ai/djl/ndarray/NDArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -4630,7 +4630,12 @@ default NDArray oneHot(int depth) {
* Batchwise product of this {@code NDArray} and the other {@code NDArray}.
*
* <ul>
* <li> batch_dot is used to compute dot product of x and y when x and y are data in batch, namely N-D (N >= 3) arrays in shape of (B0, …, B_i, :, :).
* <li>batch_dot is used to compute dot product of x and y when x and y are data in batch,
* namely N-D (N greater or equal to 3) arrays in shape of (B0, …, B_i, :, :). For
* example, given x with shape (B_0, …, B_i, N, M) and y with shape (B_0, …, B_i, M, K),
* the result array will have shape (B_0, …, B_i, N, K), which is computed by:
* batch_dot(x,y)[b_0, ..., b_i, :, :] = dot(x[b_0, ..., b_i, :, :], y[b_0, ..., b_i, :,
* :])
* </ul>
*
* <p>Examples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,10 @@ public void testBatchDot() {
NDArray array1 = manager.ones(new Shape(2, 1, 4));
NDArray array2 = manager.ones(new Shape(2, 4, 6));
NDArray expected = manager.create(4f).tile(12).reshape(new Shape(2, 1, 6));
Assert.assertEquals(array1.batchDot(array2), expected, "batch dot product: Incorrect value in result ndarray");
Assert.assertEquals(
array1.batchDot(array2),
expected,
"batch dot product: Incorrect value in result ndarray");
}
}
}

0 comments on commit 601bd15

Please sign in to comment.