Skip to content

Commit

Permalink
correct error creating tensors
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Oct 27, 2023
1 parent 5fcda4d commit e398a31
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private static Tensor<TUint8> buildUByte(
int[] sArr = new int[tensorShape.length];
for (int i = 0; i < sArr.length; i ++)
sArr[i] = (int) tensorShape[i];
blocks.copy( new long[tensorShape.length], flatArr, sArr );
blocks.copy( tensor.minAsLongArray(), flatArr, sArr );
ByteDataBuffer dataBuffer = RawDataBufferFactory.create(flatArr, false);
Tensor<TUint8> ndarray = Tensor.of(TUint8.DTYPE, Shape.of(ogShape), dataBuffer);
return ndarray;
Expand Down Expand Up @@ -170,7 +170,7 @@ private static Tensor<TInt32> buildInt(
int[] sArr = new int[tensorShape.length];
for (int i = 0; i < sArr.length; i ++)
sArr[i] = (int) tensorShape[i];
blocks.copy( new long[tensorShape.length], flatArr, sArr );
blocks.copy( tensor.minAsLongArray(), flatArr, sArr );
IntDataBuffer dataBuffer = RawDataBufferFactory.create(flatArr, false);
Tensor<TInt32> ndarray = TInt32.tensorOf(Shape.of(ogShape), dataBuffer);
return ndarray;
Expand Down Expand Up @@ -200,7 +200,7 @@ private static Tensor<TInt64> buildLong(
int[] sArr = new int[tensorShape.length];
for (int i = 0; i < sArr.length; i ++)
sArr[i] = (int) tensorShape[i];
blocks.copy( new long[tensorShape.length], flatArr, sArr );
blocks.copy( tensor.minAsLongArray(), flatArr, sArr );
LongDataBuffer dataBuffer = RawDataBufferFactory.create(flatArr, false);
Tensor<TInt64> ndarray = TInt64.tensorOf(Shape.of(ogShape), dataBuffer);
return ndarray;
Expand Down Expand Up @@ -230,7 +230,7 @@ private static Tensor<TFloat32> buildFloat(
int[] sArr = new int[tensorShape.length];
for (int i = 0; i < sArr.length; i ++)
sArr[i] = (int) tensorShape[i];
blocks.copy( new long[tensorShape.length], flatArr, sArr );
blocks.copy( tensor.minAsLongArray(), flatArr, sArr );
FloatDataBuffer dataBuffer = RawDataBufferFactory.create(flatArr, false);
Tensor<TFloat32> ndarray = TFloat32.tensorOf(Shape.of(ogShape), dataBuffer);
return ndarray;
Expand Down Expand Up @@ -260,7 +260,7 @@ private static Tensor<TFloat64> buildDouble(
int[] sArr = new int[tensorShape.length];
for (int i = 0; i < sArr.length; i ++)
sArr[i] = (int) tensorShape[i];
blocks.copy( new long[tensorShape.length], flatArr, sArr );
blocks.copy( tensor.minAsLongArray(), flatArr, sArr );
DoubleDataBuffer dataBuffer = RawDataBufferFactory.create(flatArr, false);
Tensor<TFloat64> ndarray = TFloat64.tensorOf(Shape.of(ogShape), dataBuffer);
return ndarray;
Expand Down

0 comments on commit e398a31

Please sign in to comment.