|
1 | 1 | package io.milvus.common.utils; |
2 | 2 |
|
| 3 | +import java.nio.Buffer; |
3 | 4 | import java.nio.ByteBuffer; |
4 | 5 | import java.nio.ByteOrder; |
5 | 6 | import java.nio.ShortBuffer; |
@@ -161,7 +162,7 @@ public static ByteBuffer f32VectorToBf16Buffer(List<Float> vector) { |
161 | 162 | * @return List of Float a float32 vector |
162 | 163 | */ |
163 | 164 | public static List<Float> fp16BufferToVector(ByteBuffer buf) { |
164 | | - buf.rewind(); // reset the read position |
| 165 | + ((Buffer) buf).rewind(); // reset the read position |
165 | 166 | List<Float> vector = new ArrayList<>(); |
166 | 167 | ShortBuffer sbuf = buf.asShortBuffer(); |
167 | 168 | for (int i = 0; i < sbuf.limit(); i++) { |
@@ -198,7 +199,7 @@ public static ByteBuffer f32VectorToFp16Buffer(List<Float> vector) { |
198 | 199 | * @return List of Float the vector is converted to float32 values |
199 | 200 | */ |
200 | 201 | public static List<Float> bf16BufferToVector(ByteBuffer buf) { |
201 | | - buf.rewind(); // reset the read position |
| 202 | + ((Buffer) buf).rewind(); // reset the read position |
202 | 203 | List<Float> vector = new ArrayList<>(); |
203 | 204 | ShortBuffer sbuf = buf.asShortBuffer(); |
204 | 205 | for (int i = 0; i < sbuf.limit(); i++) { |
@@ -234,7 +235,7 @@ public static ByteBuffer f16VectorToBuffer(List<Short> vector) { |
234 | 235 | * @return List of Short the vector is converted to a list of Short, each Short value is a float16 value |
235 | 236 | */ |
236 | 237 | public static List<Short> bufferToF16Vector(ByteBuffer buf) { |
237 | | - buf.rewind(); // reset the read position |
| 238 | + ((Buffer) buf).rewind(); // reset the read position |
238 | 239 | List<Short> vector = new ArrayList<>(); |
239 | 240 | ShortBuffer sbuf = buf.asShortBuffer(); |
240 | 241 | for (int i = 0; i < sbuf.limit(); i++) { |
|
0 commit comments