@@ -21,39 +21,39 @@ public static ByteDataBuffer toBytes(TF_Tensor nativeTensor) {
2121 if (TensorRawDataBufferFactory .canBeUsed ()) {
2222 return TensorRawDataBufferFactory .mapTensorToBytes (tensorMemory );
2323 }
24- return DataBuffers .wrap (tensorMemory .asByteBuffer ());
24+ return DataBuffers .from (tensorMemory .asByteBuffer ());
2525 }
2626
2727 public static IntDataBuffer toInts (TF_Tensor nativeTensor ) {
2828 Pointer tensorMemory = tensorMemory (nativeTensor );
2929 if (TensorRawDataBufferFactory .canBeUsed ()) {
3030 return TensorRawDataBufferFactory .mapTensorToInts (tensorMemory );
3131 }
32- return DataBuffers .wrap (tensorMemory .asByteBuffer ().asIntBuffer ());
32+ return DataBuffers .from (tensorMemory .asByteBuffer ().asIntBuffer ());
3333 }
3434
3535 public static LongDataBuffer toLongs (TF_Tensor nativeTensor ) {
3636 Pointer tensorMemory = tensorMemory (nativeTensor );
3737 if (TensorRawDataBufferFactory .canBeUsed ()) {
3838 return TensorRawDataBufferFactory .mapTensorToLongs (tensorMemory );
3939 }
40- return DataBuffers .wrap (tensorMemory .asByteBuffer ().asLongBuffer ());
40+ return DataBuffers .from (tensorMemory .asByteBuffer ().asLongBuffer ());
4141 }
4242
4343 public static FloatDataBuffer toFloats (TF_Tensor nativeTensor ) {
4444 Pointer tensorMemory = tensorMemory (nativeTensor );
4545 if (TensorRawDataBufferFactory .canBeUsed ()) {
4646 return TensorRawDataBufferFactory .mapTensorToFloats (tensorMemory );
4747 }
48- return DataBuffers .wrap (tensorMemory .asByteBuffer ().asFloatBuffer ());
48+ return DataBuffers .from (tensorMemory .asByteBuffer ().asFloatBuffer ());
4949 }
5050
5151 public static DoubleDataBuffer toDoubles (TF_Tensor nativeTensor ) {
5252 Pointer tensorMemory = tensorMemory (nativeTensor );
5353 if (TensorRawDataBufferFactory .canBeUsed ()) {
5454 return TensorRawDataBufferFactory .mapTensorToDoubles (tensorMemory );
5555 }
56- return DataBuffers .wrap (tensorMemory .asByteBuffer ().asDoubleBuffer ());
56+ return DataBuffers .from (tensorMemory .asByteBuffer ().asDoubleBuffer ());
5757 }
5858
5959 public static StringTensorBuffer toStrings (TF_Tensor nativeTensor , long numElements ) {
@@ -68,10 +68,10 @@ public static StringTensorBuffer toStrings(TF_Tensor nativeTensor, long numEleme
6868
6969 LongBuffer offsetBuffer = dataBuffer .asLongBuffer ();
7070 offsetBuffer .limit ((int )numElements );
71- LongDataBuffer offsets = DataBuffers .wrap (offsetBuffer .slice ());
71+ LongDataBuffer offsets = DataBuffers .from (offsetBuffer .slice ());
7272
7373 dataBuffer .position ((int )numElements * Long .BYTES );
74- ByteDataBuffer data = DataBuffers .wrap (dataBuffer .slice ());
74+ ByteDataBuffer data = DataBuffers .from (dataBuffer .slice ());
7575
7676 return new StringTensorBuffer (offsets , data );
7777 }
0 commit comments