MCPcopy Create free account
hub / github.com/tensorflow/tfjs / transform

Function transform

tfjs-backend-webgl/src/kernels/Transform.ts:23–42  ·  view source on GitHub ↗
(args: {
  inputs: TransformInputs,
  backend: MathBackendWebGL,
  attrs: TransformAttrs
})

Source from the content-addressed store, hash-verified

21import {TransformProgram} from '../transform_gpu';
22
23export 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
44export const transformConfig: KernelConfig = {
45 kernelName: Transform,

Callers

nothing calls this directly

Calls 1

runWebGLProgramMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…