1
$\begingroup$

I have implemented an encoder-decoder architecture-based neural network with Neural Network API(NNAPI) Android Ndk.

There are 5 encoders and 5 decoders. The first encoder's input dimension is -> 1x160084 and the last encoder's output dimensions are 1x624. It takes 6 seconds to finish. Every encoder contains two convolutions.

The first Decoder's input dimension -> 1x624 and the last decoder's output dimensions are 1X160084. It takes 26 seconds to finish. Every decoder has a convolution and a transposed convolution.

The execution time is much slower in the decoder. But both work on the roughly same size of data. Why is there such a difference? I need to decrease the execution time for the decoder. I have found that transposed convolution is taking maximum time.

For the first transpose convolution input dimension is (1x624x1024) Output dimension is (1x2500x512),kernel size is (1x8x1024). Stride is 4. It is taking almost 5 seconds for this transpose convolution operation.

If we used a naive approach for transposed convolution it would take -> 1024 * 624 * 8 * 512 * 2 = 5234491392 operations. So it would be executed in 52s(if 1e8 operations are executed in 1 s). So there might be some optimization NNAPI implementation for transposed convolution.

Is there any way to see the implementation of NNAPI for transposed convolution and how to further improve it?

$\endgroup$

2 Answers 2

1
$\begingroup$

I suggest using a bilinear interpolation followed by a convolution instead of deconvolution. Deconvolution is prone to checkerboard artifacts. It may also helps in terms of execution speed.

$\endgroup$
1
  • $\begingroup$ Thanks for your suggestion. I am trying this. $\endgroup$ Sep 2, 2023 at 14:16
0
$\begingroup$

That's a research problem. Hope the work made by this paper will help you to understand. https://scholar.google.com/citations?view_op=view_citation&hl=en&user=iZ7DIXcAAAAJ&citation_for_view=iZ7DIXcAAAAJ:abG-DnoFyZgC

$\endgroup$
2
  • $\begingroup$ While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review $\endgroup$
    – Ethan
    Nov 9, 2022 at 23:05
  • $\begingroup$ As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. $\endgroup$
    – Community Bot
    Nov 10, 2022 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.