@@ -124,7 +124,7 @@ public static <T extends Type<T>> OnnxTensor build(RandomAccessibleInterval<T> r
124
124
private static OnnxTensor buildByte (RandomAccessibleInterval <ByteType > tensor , OrtEnvironment env ) throws OrtException
125
125
{
126
126
long [] ogShape = tensor .dimensionsAsLongArray ();
127
- if (CommonUtils .int32Overflows (ogShape ))
127
+ if (CommonUtils .int32Overflows (ogShape , 1 ))
128
128
throw new IllegalArgumentException ("Provided tensor with shape " + Arrays .toString (ogShape )
129
129
+ " is too big. Max number of elements per tensor supported: " + Integer .MAX_VALUE );
130
130
tensor = Utils .transpose (tensor );
@@ -162,9 +162,9 @@ private static OnnxTensor buildByte(RandomAccessibleInterval<ByteType> tensor, O
162
162
private static OnnxTensor buildInt (RandomAccessibleInterval <IntType > tensor , OrtEnvironment env ) throws OrtException
163
163
{
164
164
long [] ogShape = tensor .dimensionsAsLongArray ();
165
- if (CommonUtils .int32Overflows (ogShape ))
165
+ if (CommonUtils .int32Overflows (ogShape , 4 ))
166
166
throw new IllegalArgumentException ("Provided tensor with shape " + Arrays .toString (ogShape )
167
- + " is too big. Max number of elements per tensor supported: " + Integer .MAX_VALUE );
167
+ + " is too big. Max number of elements per tensor supported: " + Integer .MAX_VALUE / 4 );
168
168
tensor = Utils .transpose (tensor );
169
169
long [] tensorShape = tensor .dimensionsAsLongArray ();
170
170
int size = 1 ;
@@ -200,9 +200,9 @@ private static OnnxTensor buildInt(RandomAccessibleInterval<IntType> tensor, Ort
200
200
private static OnnxTensor buildFloat (RandomAccessibleInterval <FloatType > tensor , OrtEnvironment env ) throws OrtException
201
201
{
202
202
long [] ogShape = tensor .dimensionsAsLongArray ();
203
- if (CommonUtils .int32Overflows (ogShape ))
203
+ if (CommonUtils .int32Overflows (ogShape , 4 ))
204
204
throw new IllegalArgumentException ("Provided tensor with shape " + Arrays .toString (ogShape )
205
- + " is too big. Max number of elements per tensor supported: " + Integer .MAX_VALUE );
205
+ + " is too big. Max number of elements per tensor supported: " + Integer .MAX_VALUE / 4 );
206
206
tensor = Utils .transpose (tensor );
207
207
long [] tensorShape = tensor .dimensionsAsLongArray ();
208
208
int size = 1 ;
@@ -238,9 +238,9 @@ private static OnnxTensor buildFloat(RandomAccessibleInterval<FloatType> tensor,
238
238
private static OnnxTensor buildDouble (RandomAccessibleInterval <DoubleType > tensor , OrtEnvironment env ) throws OrtException
239
239
{
240
240
long [] ogShape = tensor .dimensionsAsLongArray ();
241
- if (CommonUtils .int32Overflows (ogShape ))
241
+ if (CommonUtils .int32Overflows (ogShape , 8 ))
242
242
throw new IllegalArgumentException ("Provided tensor with shape " + Arrays .toString (ogShape )
243
- + " is too big. Max number of elements per tensor supported: " + Integer .MAX_VALUE );
243
+ + " is too big. Max number of elements per tensor supported: " + Integer .MAX_VALUE / 8 );
244
244
tensor = Utils .transpose (tensor );
245
245
long [] tensorShape = tensor .dimensionsAsLongArray ();
246
246
int size = 1 ;
0 commit comments