SetUnknownShape

Description

Sets the input tensor shape to a known rank and marks each dimension length as unknown.

Prototype

void SetUnknownShape(int64_t rank, gert::Shape &shape)

Parameters

Parameter

Input/Output

Description

rank

Input

Shape rank.

shape

Output

The shape is set to a known rank, with each dimension length marked as unknown.

Return Value

None.

Constraints

None.

Example

The following sample code is for reference only. Do not copy and run it.

1
2
3
4
5
6
7
8
auto in_shape = context->GetInputShape(0);
OP_CHECK_NULL_WITH_CONTEXT(context, in_shape);
auto out_shape = context->GetOutputShape(0);
OP_CHECK_NULL_WITH_CONTEXT(context, out_shape);

if (Ops::Base::IsUnknownShape(*in_shape)) {
    Ops::Base::SetUnknownShape(0, *out_shape);
}