infer_shape

Applicable Products

All processors

Function Usage

Performs full-graph shape inference on the input graph based on the input shape.

This API is used only for shape inference. It does not perform any other optimizations (such as constant folding and dead-edge elimination) on the graph.

Prototype

1
infer_shape(graph: Graph, input_shapes: List[List[int]]) -> None

Parameters

Parameter

Input/Output

Description

graph

Input

Graph to be inferred.

input_shapes

Input

Graph input shape.

Returns

None

Restrictions

  • If input_shapes is not a list of integer lists, TypeError is thrown.
  • If shape inference fails, RuntimeError is thrown.