FilesLast commitLast update
2 months ago
2 months ago
19 days ago
8 days ago
8 days ago
19 days ago
8 days ago
1 month ago
12 days ago
README

SpaceToDepth

English | 简体中文

Product Support Status

Product Supported
Ascend 950PR&950DT products √
Atlas A3 products √
Atlas A2 products √
Atlas 200I/500 A2 inference products ×
Atlas inference products √
Atlas training products √

Function Description

  • Operator function: moves data in the spatial dimensions (height and width) to the depth (channel) dimension.

  • Function Description: This operator rearranges the spatial dimensions (height and width) of the input tensor and converts them into the depth (channel) dimension. Specifically, it divides the height and width dimensions of the input tensor into blocks of the specified block size (block_size), and rearranges these spatial blocks into the channel dimension. As a result, the size of the spatial dimensions decreases, while the depth of the channel dimension increases.

  • Computation formula: Assume that the input tensor shape is:

    • If data_format="NHWC": [batch, height, width, channels]
    • If data_format="NCHW": [batch, channels, height, width]

    Assume that block_size is B. The output tensor shape is:

    • If data_format="NHWC": [batch, height/B, width/B, channels*B*B]
    • If data_format="NCHW": [batch, channels*B*B, height/B, width/B]

    B must integer-divide both the height and width dimensions.

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
x Input Input tensor, which supports multiple data types. The data format must be the same as the format specified by the data_format attribute FLOAT, FLOAT16, INT8, INT16, INT32, UINT8, UINT16, UINT32, INT64, UINT64, BFLOAT16 NHWC, NCHW
y Output Output tensor, which has the same data type as the input x. The output shape is computed based on block_size and data_format Same as x NHWC, NCHW
block_size Attribute (Required) Size of the spatial block. This parameter must be an integer greater than 1. The height and width dimensions must be divisible by block_size INT -
data_format Attribute (Optional) Data format, which specifies the dimension order of the input and output. Both "NHWC" and "NCHW" formats are supported, and the default value is "NHWC" STRING -

Constraint Description

None

Invocation Description

Invocation Method Sample Code Description
Graph-mode invocation test_geir_space_to_depth Invokes the SpaceToDepth operator by building a graph through the operator IR.