* Create a shape tuple to pass to runtime. * @param shape The shape . * @returns The created shape tuple.
(shape: Array<number>)
| 1702 | * @returns The created shape tuple. |
| 1703 | */ |
| 1704 | makeShapeTuple(shape: Array<number>): TVMObject { |
| 1705 | const key = CacheState.computeShapeKey(shape); |
| 1706 | return this.cacheState.shapeCache.get(key, () => { |
| 1707 | const shapeArray = shape.map((value) => new Scalar(value, "int")); |
| 1708 | const tuple = this.ctx.makeShapeTuple(...shapeArray); |
| 1709 | // Detach from scope so the cached object survives across scopes. |
| 1710 | this.detachFromCurrentScope(tuple); |
| 1711 | return tuple; |
| 1712 | }) as TVMObject; |
| 1713 | } |
| 1714 | /** |
| 1715 | * Get type index from type key. |
| 1716 | * @param typeKey The type key. |
no test coverage detected