Return a copied flat java array of current array (row-major). The Tensor dtype must be int32 @return A copy of array content.
()
| 253 | * @return A copy of array content. |
| 254 | */ |
| 255 | public int[] asIntArray() { |
| 256 | if (dtype.typeCode != TVMType.INT || dtype.bits != 32) { |
| 257 | throw new IllegalArgumentException( |
| 258 | "Cannot set convert to int[] for " + dtype.toString() + " array"); |
| 259 | } |
| 260 | byte[][] units = groupInternalBytes(); |
| 261 | int[] array = new int[units.length]; |
| 262 | for (int i = 0; i < units.length; ++i) { |
| 263 | array[i] = wrapBytes(units[i]).getInt(); |
| 264 | } |
| 265 | return array; |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * Return a copied flat java array of current array (row-major). |