MCPcopy Index your code
hub / github.com/apache/tvm / asFloatArray

Method asFloatArray

jvm/core/src/main/java/org/apache/tvm/Tensor.java:219–230  ·  view source on GitHub ↗

Return a copied flat java array of current array (row-major). The Tensor dtype must be float32 @return A copy of array content.

()

Source from the content-addressed store, hash-verified

217 * @return A copy of array content.
218 */
219 public float[] asFloatArray() {
220 if (dtype.typeCode != TVMType.FLOAT || dtype.bits != 32) {
221 throw new IllegalArgumentException(
222 "Cannot set convert to float[] for " + dtype.toString() + " array");
223 }
224 byte[][] units = groupInternalBytes();
225 float[] array = new float[units.length];
226 for (int i = 0; i < units.length; ++i) {
227 array[i] = wrapBytes(units[i]).getFloat();
228 }
229 return array;
230 }
231
232 /**
233 * Return a copied flat java array of current array (row-major).

Callers 4

invokeMethod · 0.95
test_from_float32Method · 0.95

Calls 3

groupInternalBytesMethod · 0.95
wrapBytesMethod · 0.95
toStringMethod · 0.45

Tested by 4

invokeMethod · 0.76
test_from_float32Method · 0.76