(args: {
backend: BackendWasm,
inputs: ArgMinInputs&ArgMaxInputs,
attrs: ArgMinAttrs&ArgMaxAttrs,
})
| 38 | } |
| 39 | |
| 40 | function kernelFunc(args: { |
| 41 | backend: BackendWasm, |
| 42 | inputs: ArgMinInputs&ArgMaxInputs, |
| 43 | attrs: ArgMinAttrs&ArgMaxAttrs, |
| 44 | }): TensorInfo { |
| 45 | const {backend, inputs, attrs} = args; |
| 46 | const {axis} = attrs; |
| 47 | const {x} = inputs; |
| 48 | const xId = backend.dataIdMap.get(x.dataId).id; |
| 49 | let inputId = xId; |
| 50 | let input = x; |
| 51 | |
| 52 | const {transposed, axes, inputWasTransposed} = |
| 53 | permuteAxesAndTranspose(x, axis, backend); |
| 54 | |
| 55 | if (inputWasTransposed) { |
| 56 | const transposedId = backend.dataIdMap.get(transposed.dataId).id; |
| 57 | if (transposedId !== xId) { |
| 58 | // transpose was not a no-op. We will need to dispose of this |
| 59 | // once we are done. |
| 60 | input = transposed; |
| 61 | inputId = transposedId; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | const outShape = input.shape.slice(0, -1); |
| 66 | const out = backend.makeOutput(outShape, 'int32'); |
| 67 | const outId = backend.dataIdMap.get(out.dataId).id; |
| 68 | const outerSize = util.sizeFromShape(out.shape); |
| 69 | const innerSize = input.shape[axes[0]]; |
| 70 | wasmFunc(inputId, CppDType[input.dtype], outerSize, innerSize, outId); |
| 71 | |
| 72 | if (inputWasTransposed) { |
| 73 | // dispose of the transposed tensor. |
| 74 | backend.disposeData(transposed.dataId); |
| 75 | } |
| 76 | |
| 77 | return out; |
| 78 | } |
| 79 | |
| 80 | return { |
| 81 | kernelName, |
nothing calls this directly
no test coverage detected
searching dependent graphs…