onnxruntime
ecca1134 - [js/common] allow creating (u)int64 tensors in 2 ways (#16541)

Commit
2 years ago
[js/common] allow creating (u)int64 tensors in 2 ways (#16541) ### Description allow creating (u)int64 tensors from either a number array or a bigint array. before: ```js // TypeScript think is good, but actually does not work // runtime error: Uncaught TypeError: Cannot convert 1 to a BigInt const myTensor1 = new Tensor('int64', [1, 2, 3, 4], [2, 2]); // runtime good, but TypeScript thinks myTensor2 is a string tensor const myTensor2 = new Tensor('int64', [1n, 2n, 3n, 4n], [2, 2]); ``` after: ```js // both work at runtime and TypeScript populates the correct types const myTensor1 = new Tensor('int64', [1, 2, 3, 4], [2, 2]); const myTensor2 = new Tensor('int64', [1n, 2n, 3n, 4n], [2, 2]); ```
Author
Parents
Loading