Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@xadupre
Copy link
Contributor

@xadupre xadupre commented Mar 30, 2023

Description

Current implementation of Operator Conv is very slow. This is a faster one based on im2col.

Measures with shape(X)=(1, 1, 64, 64), shape(kernel)=(3, 3), before time is 0.0033s, after time is 0.00075, > 4 times faster. This ratio is higher with bigger matrices.

Motivation and Context

Performance.

@xadupre xadupre changed the title [WIP] Faster rference implementation for operator Conv based on im2col [WIP] Faster reference implementation for operator Conv based on im2col Mar 30, 2023
xadupre added 2 commits March 30, 2023 18:37
Signed-off-by: xadupre <[email protected]>
@xadupre xadupre changed the title [WIP] Faster reference implementation for operator Conv based on im2col Faster reference implementation for operator Conv based on im2col Apr 3, 2023
Co-authored-by: Justin Chu <[email protected]>
Signed-off-by: Xavier Dupré <[email protected]>
@gramalingam
Copy link
Contributor

A general idea (applies to both conv and im2col). It makes sense to me to support multiple implementations of an op (specifically, here, one may be slower/naive but easier to verify correct or read and understand, while another may be more efficient).

Shall we adopt some naming convention for the methods in the classes that implement the ops to support this?

So, for example, your naive implementation of im2col can go back into the main class (instead of being in the testing code). We just use an appropriate suffix to distinguish the two implementations. Eg., may be add _optimized for the faster on. Or, add _spec to the naive implementation.

@xadupre xadupre enabled auto-merge (squash) May 11, 2023 09:50
@xadupre xadupre merged commit 61dbadb into onnx:main May 11, 2023
adityagoel4512 pushed a commit to adityagoel4512/onnx that referenced this pull request Jul 28, 2023
…nx#5069)

Signed-off-by: xadupre <[email protected]>
Signed-off-by: Xavier Dupré <[email protected]>
Co-authored-by: Justin Chu <[email protected]>
Signed-off-by: Aditya Goel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants