Overview

The ExpandDimsType class defines the rules for expanding dimensions based on the shapes resulting from the expansion.

Dimension expansion refers to a process of adding one or more dimensions to the original shape. For example, there is an original shape [2,2] that has two axes. After two dimensions are expanded between the two axes, the shape changes to [2,1,1,2]. After dimension expansion, the 0th and 3rd axes of the shape are called original axes, and the 1st and 2nd axes are called dimension-expanded axes.

The ExpandDimsType class uses 1 and 0 to describe dimension expansion rules. The value 1 indicates that the current axis is a dimension-expanded axis, and the value 0 indicates that the current axis is an original axis. The values from left to right indicate the source of each axis in the current shape.

Table 1 Description of dimension expansion rules

Dimension Expansion Rule

Shape Before Dimension Expansion

Shape After Dimension Expansion

0110

[2, 2]

[2, 1, 1, 2]

100

[2, 3]

[1, 2, 3]

1000

[2, 3]

The dimension expansion rule does not match the original shape. The rule specifies that there are three original axes, but the original shape has only two axes. As a result, an error is reported.