Skip to main content

TensorMath.sum

Function

Calculate the sum of the inTensor elements and store result in the outTensor.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

sum(inTensor, inShape, axis, outTensor): void

Calculate the sum of the inTensor elements and store result in the outTensor.

Axis specifies axis along which a sum is performed., e.g:

axis(0, 0, 0): the sum will be performed on the whole tensor

axis(0, 0, 1): the sum will be performed along the z axis. outTensor will store inShape.z values

axis(1, 1, 0): the sum will be performed along x and y axes. outTensor will store

inShape.x * inShape.y values, where outTensor[y][x] is the sum of all inTensor[0..inShape.z-1][y][x] values

Parameters

ParameterType
inTensorFloat32Array
inShapevec3
axisvec3
outTensorFloat32Array

Returns

void