(aShape: number[], newDim: number[])
| 25 | rank: number; |
| 26 | |
| 27 | constructor(aShape: number[], newDim: number[]) { |
| 28 | const outputShape: number[] = new Array(aShape.length); |
| 29 | for (let i = 0; i < outputShape.length; i++) { |
| 30 | outputShape[i] = aShape[newDim[i]]; |
| 31 | } |
| 32 | this.outputShape = outputShape; |
| 33 | this.rank = outputShape.length; |
| 34 | const dtype = getCoordsDataType(this.rank); |
| 35 | const switched = getSwitchedCoords(newDim); |
| 36 | |
| 37 | this.userCode = ` |
| 38 | void main() { |
| 39 | ${dtype} resRC = getOutputCoords(); |
| 40 | setOutput(getA(${switched})); |
| 41 | } |
| 42 | `; |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | function getSwitchedCoords(newDim: number[]): string { |
nothing calls this directly
no test coverage detected