in ndarray/src/main/java/org/tensorflow/ndarray/impl/buffer/raw/FloatRawDataBuffer.java [109:140]
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof FloatDataBuffer)) {
return super.equals(obj);
}
FloatDataBuffer other = (FloatDataBuffer)obj;
if (size() != other.size()) {
return false;
}
return other.accept(new DataStorageVisitor<Boolean>() {
@Override
public Boolean visit(FloatBuffer buffer) {
if (memory.isArray()) {
return buffer.equals(memory.toArrayFloatBuffer());
}
return fallback();
}
@Override
public Boolean fallback() {
for (long idx = 0L; idx < size(); ++idx) {
if (other.getFloat(idx) != getFloat(idx)) {
return false;
}
}
return true;
}
});
}