Class: TensorFilterGraph


A TensorFilterGraph consists of a set of operations, implemented using TensorFilter subclasses. Each filter has a set of inputs, a single output and is executed in a single draw call. As certain filters, e.g. a sum reduce, require multiple passes, the TensorFilterGraph holds a collection of such filters and manages their dependencies and required input textures.

new TensorFilterGraph()

sdk/operations/art-filter-operation/tensor-filter-graph.js, line 58


addFilter(filter, inferLogicalShapeForInputs){Number}

sdk/operations/art-filter-operation/tensor-filter-graph.js, line 95

Adds this filter to the graph and configures the main input

Name Type Default Description
filter PhotoEditorSDK.Engine.TensorFilter
inferLogicalShapeForInputs Boolean true

Whether the logical shapes for the inputs should be inferred or remain untouched

Type Description
  • The index of the newly added filter within the graph


sdk/operations/art-filter-operation/tensor-filter-graph.js, line 599
Type Description
Number The logical shape of the unpacked input image - [4].


sdk/operations/art-filter-operation/tensor-filter-graph.js, line 153

Finalizes the filter stack, compiles filters and uploads data into textures etc. Once done, the graph is ready to be executed

Name Type Description
renderer WebGLRenderer
Type Description

asyncrender(renderer, inputTarget, }, tileRectangle, blendLeftTopRightBottom, overlappingFactor, measurePerformance)

sdk/operations/art-filter-operation/tensor-filter-graph.js, line 315

This method performs style transfer on a single tile and renders the styled result to the given output target. Styling is performed on the subrect specified by tileRectangle and borders of the result are feathered according to overlappingFactor and blendLeftTopRightBottom.

Name Type Description
renderer Engine.WebGLRenderer
inputTarget Engine.WebGLRenderTarget
} Engine.WebGLRenderTarget


tileRectangle Engine.Rectangle
blendLeftTopRightBottom Array.<number>
overlappingFactor number
measurePerformance boolean


sdk/operations/art-filter-operation/tensor-filter-graph.js, line 271

Replaces the weights of this graph with new ones from the given map. Fails if architectures do not match.

Name Type Description
newWeightMap Object