Skip to content

Define "calculating output dimensions" #500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
inexorabletash opened this issue Jan 10, 2024 · 1 comment · Fixed by #582
Closed

Define "calculating output dimensions" #500

inexorabletash opened this issue Jan 10, 2024 · 1 comment · Fixed by #582

Comments

@inexorabletash
Copy link
Contributor

Various graph builder methods (7 of them?) contain this or similar phrasing:

Let outputShape be the result of invoking the underlying implementation for calculating output dimensions, given options.

Is this truly expected to be implementation dependent, or can it be rigorously specified on a per-op basis?

@huningxin
Copy link
Contributor

I think the output shape inference should be implementation independent and be specified per-op. The spec mentions the output shape calculation for some ops. For example,

for Element-wise unary operations

The shape of the output tensor is the same as the shape of input tensor.

for conv2d,

More specifically, the spatial dimensions or the sizes of the last two dimensions of the output tensor for the nchw input layout can be calculated as follow:

outputSize = 1 + (inputSize - (filterSize - 1) * dilation - 1 + beginningPadding + endingPadding) / stride

They should be reflected in algorithm steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants