Return a copied flat java array of current array (row-major). The Tensor dtype must be float64 @return A copy of array content.
()
| 199 | * @return A copy of array content. |
| 200 | */ |
| 201 | public double[] asDoubleArray() { |
| 202 | if (dtype.typeCode != TVMType.FLOAT || dtype.bits != 64) { |
| 203 | throw new IllegalArgumentException( |
| 204 | "Cannot set convert to double[] for " + dtype.toString() + " array"); |
| 205 | } |
| 206 | byte[][] units = groupInternalBytes(); |
| 207 | double[] array = new double[units.length]; |
| 208 | for (int i = 0; i < units.length; ++i) { |
| 209 | array[i] = wrapBytes(units[i]).getDouble(); |
| 210 | } |
| 211 | return array; |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * Return a copied flat java array of current array (row-major). |