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

Method copyFrom

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

Copy from a native array. The Tensor type must by float64 @param sourceArray the source data

(double[] sourceArray)

Source from the content-addressed store, hash-verified

41 * @param sourceArray the source data
42 */
43 public void copyFrom(double[] sourceArray) {
44 checkCopySize(sourceArray.length);
45 if (dtype.typeCode != TVMType.FLOAT || dtype.bits != 64) {
46 throw new IllegalArgumentException("Cannot set double[] for " + dtype.toString() + " array");
47 }
48 byte[] nativeArr = new byte[sourceArray.length * dtype.numOfBytes];
49 for (int i = 0; i < sourceArray.length; ++i) {
50 wrapBytes(nativeArr, i * dtype.numOfBytes, dtype.numOfBytes).putDouble(sourceArray[i]);
51 }
52 Base.checkCall(Base._LIB.tvmFFIDLTensorCopyFromJArray(nativeArr, this.dltensorHandle));
53 }
54
55 /**
56 * Copy from a native array.

Callers 10

test_sum_tensorMethod · 0.95
test_from_float32Method · 0.95
test_from_float64Method · 0.95
test_from_int8Method · 0.95
test_from_int16Method · 0.95
test_from_int32Method · 0.95
test_from_int64Method · 0.95
test_from_uint16Method · 0.95

Calls 6

checkCopySizeMethod · 0.95
wrapBytesMethod · 0.95
checkCallMethod · 0.95
copyFromRawMethod · 0.95
toStringMethod · 0.45

Tested by 10

test_sum_tensorMethod · 0.76
test_from_float32Method · 0.76
test_from_float64Method · 0.76
test_from_int8Method · 0.76
test_from_int16Method · 0.76
test_from_int32Method · 0.76
test_from_int64Method · 0.76
test_from_uint16Method · 0.76