(dtype, arrayType)
| 34 | |
| 35 | // Test ndarray |
| 36 | function testArrayCopy(dtype, arrayType) { |
| 37 | let data = [1, 2, 3, 4, 5, 6]; |
| 38 | let a = tvm.empty([2, 3], dtype).copyFrom(data); |
| 39 | |
| 40 | assert(a.device.toString() == "cpu:0"); |
| 41 | assert(a.shape[0] == 2 && a.shape[1] == 3); |
| 42 | |
| 43 | let ret = a.toArray(); |
| 44 | assert(ret instanceof arrayType); |
| 45 | assert(ret.toString() == arrayType.from(data).toString()); |
| 46 | } |
| 47 | |
| 48 | test("array copy", () => { |
| 49 | tvm.withNewScope(() => { |