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.

Header Files to Be Included

1
#include <expand_dims_type.h>

Public Member Functions

ExpandDimsType() : size_(0U), mask_(0U)
explicit ExpandDimsType(const ge::char_t *const expand_dims_type)
explicit ExpandDimsType(const int64_t reshape_type_mask)
bool operator==(const ExpandDimsType &other) const
AxisIndex GetFullSize() const
void SetExpandIndex(const AxisIndex index)
bool IsExpandIndex(const AxisIndex index) const
ge::graphStatus Expand(const Shape &shape, Shape &out_shape) const
ge::graphStatus Expand(Shape &shape) const