Return a copied flat java array of current array (row-major). The Tensor dtype must be uint16 @return A copy of array content.
()
| 289 | * @return A copy of array content. |
| 290 | */ |
| 291 | public char[] asCharArray() { |
| 292 | if (dtype.typeCode != TVMType.UINT || dtype.bits != 16) { |
| 293 | throw new IllegalArgumentException( |
| 294 | "Cannot set convert to char[] for " + dtype.toString() + " array"); |
| 295 | } |
| 296 | byte[][] units = groupInternalBytes(); |
| 297 | char[] array = new char[units.length]; |
| 298 | for (int i = 0; i < units.length; ++i) { |
| 299 | array[i] = wrapBytes(units[i]).getChar(); |
| 300 | } |
| 301 | return array; |
| 302 | } |
| 303 | |
| 304 | /** |
| 305 | * Return a copied flat java array of current array (row-major). |