OutputShapeDependOnCompute

Description

Registers the list of output shapes that depend on the computation results. For certain operators, such as NonZero (which counts the number of non-zero values in a tensor), the output shape cannot be determined until the computation is complete. When defining the prototype of this type of operator, you need to use the OutputShapeDependOnCompute API to identify the operator, and write the actual output shape to the output parameters in the operator kernel function so that the framework can manage the output memory based on the information.

Prototype

OpImplRegisterV2 &OutputShapeDependOnCompute(std::initializer_list<int32_t> outputs)

Parameters

Parameter

Input/Output

Description

outputs

Input

List of output indexes.

Returns

OpImplRegisterV2 object of the operator, where the list of output shapes depending on the computation results is registered.

Restrictions

  • It can only be used to identify the operator output.
  • Currently, integrating operators into a graph is not supported.