Return a copied flat java array of current array (row-major). The Tensor dtype must be int64 @return A copy of array content.
()
| 235 | * @return A copy of array content. |
| 236 | */ |
| 237 | public long[] asLongArray() { |
| 238 | if (dtype.typeCode != TVMType.INT || dtype.bits != 64) { |
| 239 | throw new IllegalArgumentException( |
| 240 | "Cannot set convert to long[] for " + dtype.toString() + " array"); |
| 241 | } |
| 242 | byte[][] units = groupInternalBytes(); |
| 243 | long[] array = new long[units.length]; |
| 244 | for (int i = 0; i < units.length; ++i) { |
| 245 | array[i] = wrapBytes(units[i]).getLong(); |
| 246 | } |
| 247 | return array; |
| 248 | } |
| 249 | |
| 250 | /** |
| 251 | * Return a copied flat java array of current array (row-major). |