AddOutputTd

Function Usage

Adds input tensor descriptions for an operator.

Prototype

ContextBuilder &AddOutputTd(int32_t index, ge::DataType dtype, ge::Format originFormat,

ge::Format storageFormat, gert::StorageShape storageShape);

Parameters

Parameter

Input/Output

Description

index

Input

Operator output index, starting from 0.

dtype

Input

Data type of the operator output tensor.

originFormat

Input

Original format of the operator output tensor.

storageFormat

Input

Runtime format of the operator output tensor.

storageShape

Input

Shape of the operator output tensor.

Returns

Object of the current ContextBuilder

Constraints

Call the NodeIoNum and IrInstanceNum APIs before calling AddOutputTd.

Example

gert::StorageShape x_shape = {{1024, 5120}, {1024, 5120}};
gert::StorageShape output_shape = {{1024, 5210}, {1024, 5210}};
context_ascendc::ContextBuilder builder;
(void)builder
    .NodeIoNum(1, 1)
    .IrInstanceNum({1})
    .SetOpNameType("tmpName", "tmpType")
    .AddInputTd(0, ge::DT_FLOAT16, ge::FORMAT_ND, ge::FORMAT_ND, x_shape)
    .AddOutputTd(0, ge::DT_FLOAT16, ge::FORMAT_ND, ge::FORMAT_ND, output_shape)