Skip to content

Conversation

angelzzzzz
Copy link

@angelzzzzz angelzzzzz commented Oct 20, 2025

According to the ONNX spec, in the CRD mode, elements along the depth dimension from the input tensor are rearranged in the following order: column, row, and the depth. The output y is computed from the input x as below:

b, c, h, w = x.shape
tmp = np.reshape(x, [b, c // (blocksize ** 2), blocksize, blocksize, h, w])
tmp = np.transpose(tmp, [0, 1, 4, 2, 5, 3])
y = np.reshape(tmp, [b, c // (blocksize ** 2), h * blocksize, w * blocksize])

So, the input should be reshaped to [b, c / (blocksize^2), blocksize, blocksize, h, w] instead of [b, blocksize, blocksize, c / (blocksize^2), h, w].

According to the ONNX spec, in CRD mode the input should be reshaped to
[b, c / (blocksize^2), blocksize, blocksize, h, w] instead of
[b, blocksize, blocksize, c / (blocksize^2), h, w].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant