Skip to content
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

[compiler] Support dynamic shape inference for Conv2D and DepthwiseConv2D #14115

Open
pcs1265 opened this issue Sep 27, 2024 · 3 comments
Open
Labels

Comments

@pcs1265
Copy link
Member

pcs1265 commented Sep 27, 2024

Currently, we are working on enabling Yamnet to support dynamic shape inference for the Reshape operation.

In this process, we planned to infer all dimensions as unknown when the shape is not CircleConst.

According to our decision, the height, width, and number of channels will be provided to Conv2D in unknown state, resulting an incorrect inference (the unknown dim will be treated as 0).

Therefore, if the height, width, and channels of the IFM are unknown, Conv2D should infer those dimensions as unknown.

@shs-park shs-park added the SSAFY label Sep 27, 2024
@pcs1265
Copy link
Member Author

pcs1265 commented Sep 27, 2024

So I am planning this in the following sequence:

  1. Migrate Conv2D / DepthwiseConv2D related functions to sinf::Algorithm.
  2. Implement dynamic shape support for Conv2D.
  3. Implement dynamic shape support for DepthwiseConv2D.

However, I am concerned about the migration process.

template <class Conv2DType> OutputSize infer_conv2d_type(const Conv2DType *node)

There is a function infer_conv2d_type() that is shared by Conv2D and DepthwiseConv2D.
To migrate this, I have considered several ways to do this:

  1. Create HelperConv2Ds.h and include the implementation in that header file.
  2. Add the function header to CircleShapeInferenceHelper.h
    • Then the implementation will go to CircleShapeInferenceHelper.cpp
    • Explicit instantiation is necessary because infer_conv2d_type() is a template function.
  3. Follow option 2, but as a non-template function without instantiation.
    • The function will take 5 arguments (ifm_shape, ker_shape, stride, padding, dilation) -> which might be too many.

Which option do you prefer?
I was working on first method.

@seanshpark
Copy link
Contributor

seanshpark commented Sep 27, 2024

Which option do you prefer?
I was working on first method.

Please go one with your first method and lets see how it comes out.

@pcs1265
Copy link
Member Author

pcs1265 commented Sep 27, 2024

Which option do you prefer?
I was working on first method.

Please go one with your first method and lets see how it comes out.

Thank you. I'll work on this way.

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

No branches or pull requests

3 participants