(args: {
inputs: TransformInputs,
backend: MathBackendWebGL,
attrs: TransformAttrs
})
| 21 | import {TransformProgram} from '../transform_gpu'; |
| 22 | |
| 23 | export function transform(args: { |
| 24 | inputs: TransformInputs, |
| 25 | backend: MathBackendWebGL, |
| 26 | attrs: TransformAttrs |
| 27 | }): TensorInfo { |
| 28 | const {inputs, backend, attrs} = args; |
| 29 | const {image, transforms} = inputs; |
| 30 | const {interpolation, fillMode, fillValue, outputShape} = attrs; |
| 31 | |
| 32 | const [batch, imageHeight, imageWidth, numChannels] = image.shape; |
| 33 | const [outHeight, outWidth] = |
| 34 | outputShape != null ? outputShape : [imageHeight, imageWidth]; |
| 35 | const outShape = |
| 36 | [batch, outHeight, outWidth, |
| 37 | numChannels] as [number, number, number, number]; |
| 38 | |
| 39 | const program = new TransformProgram( |
| 40 | imageHeight, imageWidth, interpolation, fillMode, fillValue, outShape); |
| 41 | return backend.runWebGLProgram(program, [image, transforms], 'float32'); |
| 42 | } |
| 43 | |
| 44 | export const transformConfig: KernelConfig = { |
| 45 | kernelName: Transform, |
nothing calls this directly
no test coverage detected
searching dependent graphs…