Skip to content
This repository was archived by the owner on Jul 15, 2025. It is now read-only.

Commit b8ee473

Browse files
committed
Fix equality check and star import
1 parent dac3139 commit b8ee473

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

ndarray/src/main/java/org/tensorflow/ndarray/impl/dense/AbstractDenseNdArray.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public NdArraySequence<U> elements(int dimensionIdx) {
5454

5555
@Override
5656
public U withShape(Shape shape) {
57-
if (shape == this.shape()) {
57+
if (shape.equals(this.shape())) {
5858
return (U)this;
5959
}
6060
if (shape == null || shape.isUnknown() || shape.size() != this.shape().size()) {

ndarray/src/test/java/org/tensorflow/ndarray/NdArrayTestBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ public void withShape() {
400400
assertEquals(originalShape, originalArray.shape());
401401
assertEquals(valueOf(10L), newArray.getObject(0, 0));
402402

403-
NdArray<T> sameArray = originalArray.withShape(originalShape);
403+
NdArray<T> sameArray = originalArray.withShape(Shape.scalar());
404404
assertSame(originalArray, sameArray);
405405

406406
assertThrows(IllegalArgumentException.class, () -> originalArray.withShape(Shape.of(2)));

ndarray/src/test/java/org/tensorflow/ndarray/SparseNdArrayTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
import org.tensorflow.ndarray.impl.sparse.LongSparseNdArray;
2424
import org.tensorflow.ndarray.impl.sparse.ShortSparseNdArray;
2525

26-
import static org.junit.jupiter.api.Assertions.*;
26+
import static org.junit.jupiter.api.Assertions.assertEquals;
27+
import static org.junit.jupiter.api.Assertions.assertFalse;
28+
import static org.junit.jupiter.api.Assertions.assertThrows;
29+
import static org.junit.jupiter.api.Assertions.assertTrue;
2730

2831
public class SparseNdArrayTest {
2932
long[][] indicesArray = {{0, 0}, {1, 2}, {2, 3}};

0 commit comments

Comments
 (0)