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

Method asShortArray

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

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

()

Source from the content-addressed store, hash-verified

271 * @return A copy of array content.
272 */
273 public short[] asShortArray() {
274 if (dtype.typeCode != TVMType.INT || dtype.bits != 16) {
275 throw new IllegalArgumentException(
276 "Cannot set convert to short[] for " + dtype.toString() + " array");
277 }
278 byte[][] units = groupInternalBytes();
279 short[] array = new short[units.length];
280 for (int i = 0; i < units.length; ++i) {
281 array[i] = wrapBytes(units[i]).getShort();
282 }
283 return array;
284 }
285
286 /**
287 * Return a copied flat java array of current array (row-major).

Callers 1

test_from_int16Method · 0.95

Calls 3

groupInternalBytesMethod · 0.95
wrapBytesMethod · 0.95
toStringMethod · 0.45

Tested by 1

test_from_int16Method · 0.76