Class: TensorFilterGraph

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

Methods

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

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

getInitialInputLogicalShape(){Number}

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

load(renderer){Promise}

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
Returns:
Type Description
Promise

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

outputTarget

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

updateWeights(newWeightMap)

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