in ndarray/src/main/java/org/tensorflow/ndarray/impl/buffer/raw/BooleanRawDataBuffer.java [102:136]
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof BooleanDataBuffer)) {
return super.equals(obj);
}
BooleanDataBuffer other = (BooleanDataBuffer)obj;
if (size() != other.size()) {
return false;
}
return other.accept(new DataStorageVisitor<Boolean>() {
@Override
public Boolean visit(boolean[] array, int offset, int length) {
if (memory.isArray() && memory.arrayOffset(boolean[].class) == 0 && offset == 0) {
boolean[] thisArray = memory.array();
if (thisArray.length == array.length) {
return Arrays.equals(thisArray, array);
}
}
return fallback();
}
@Override
public Boolean fallback() {
for (long idx = 0L; idx < size(); ++idx) {
if (other.getBoolean(idx) != getBoolean(idx)) {
return false;
}
}
return true;
}
});
}