ComputeLibrary icon indicating copy to clipboard operation
ComputeLibrary copied to clipboard

Channel-wise softmax in NCHW format support

Open BhaskarsarmaP opened this issue 8 years ago • 6 comments

Hi, As per this raised issue #401

In CUDNN and MKLDNN, they are doing the channel wise softmax when the inputs and outputs are of the form NCHW. For my Query, Our Input has 3 channels , Height and width 32 and 32 respectively.They are implemeting like exp(1st)/(exp(1st)+exp(1025th)+exp(2049th)) elements. But I was unable to reproduce the same in our ARM Compute Library. Here we are getting exp(1st)/(sum of exp(all 3072)) elements. Is there a way to execute the softmax layer similar to mkldnn and cudnn in ARM COMPUTE LIBRARY

BhaskarsarmaP avatar Jun 19 '18 07:06 BhaskarsarmaP

We have marked this work as a feature request and will prioritize accordingly. For now you can do the above by performing a permute->softmax->permute which is not the most efficient solution.

GeorgeARM avatar Oct 15 '18 12:10 GeorgeARM

Hi @GeorgeARM

Can you please elaborate how permute->softmax->permute will perform softmax classifier in channelwise ?

nhkrishna avatar Oct 26 '18 13:10 nhkrishna

Hello @nhkrishna,

I suppose the request above is channel-wise softmax in NCHW format tensor. But ACL supports softmax on the width axis only. So I suppose if you permute your input to NHWC and then do softmax and then permute back to NCHW you will have the result that you want.

GeorgeARM avatar Oct 26 '18 13:10 GeorgeARM

Thanks for your reply @GeorgeARM I will try it and get back to you.

nhkrishna avatar Oct 26 '18 17:10 nhkrishna

Have you tried @nhkrishna in the end?

ManubARM avatar Feb 06 '19 16:02 ManubARM

Yes i have tried using permute->softmax->permute. It works as required.

nhkrishna avatar Feb 08 '19 12:02 nhkrishna