hollance / neural-engine

Everything we actually know about the Apple Neural Engine (ANE)
MIT License
1.97k stars 72 forks source link

Do you have any workarounds about pooling layer? #1

Closed y-ich closed 4 years ago

y-ich commented 4 years ago

Hello, Hollemans san.

Thank you for your useful repository!

I found that a pooling layer which follows a convolution prevents the convolution to run on ANE. Do you know any workarounds to avoid it?

The pooling layer is actually a global average pooling layer. I tried to turn on/off globalPooling and to replace it with reduce mean, but no better effects.

Thanks.

[Additional Information] I found that padding="VALID" causes the problem. If you use padding="SAME", the model runs on ANE, but you know it is useless since the activation outputs an output with different shape.

hollance commented 4 years ago

Ah interesting. I don't think I've used a model with VALID padding on the ANE before.

y-ich commented 4 years ago

Thank you for your comment!

I will investigate further.

teijeong commented 4 years ago

I noticed similar problem. While running the model with profiler on, os_log output says something like "kernel size > 13 is not supported in ANE". Setting globalPooling to true also didn't work.

hollance commented 4 years ago

@teijeong Interesting, thanks!

By the way, what do you mean by "While running the model with profiler on"? Which profiler is this?

teijeong commented 4 years ago

Oh I mean, the Xcode Instruments tool

hollance commented 4 years ago

@teijeong System Trace or another instrument?

teijeong commented 4 years ago

There's an instrument called os_log. (as seen here: https://developer.apple.com/videos/play/wwdc2018/405/)

hollance commented 4 years ago

Great, thanks. I don't think I've used that one before, should come in handy. 😄

teijeong commented 4 years ago

Great! Hope you enjoy the power 😎

y-ich commented 3 years ago

Neural Engine on A14 seems to have a unit for pooling. Models with pooling layers run super fast on it. Amazing.

andrewBatutin commented 3 years ago

wonder if there is a benchmark for such models