oneDNN icon indicating copy to clipboard operation
oneDNN copied to clipboard

Incorrect Reordering for the Inputs and Outputs of the convolution Layer in the mkldnn v0.17

Open BhaskarsarmaP opened this issue 7 years ago • 4 comments

Conv Layer behaving incorrectly for the below dimensions when Tried in the MKLDNN v0.17.2 layer, For conv layer Our Input data is in format nchw8c i.e n=1,c=512,h=46,w=34 Our Output data is in the format nchw i.e n=1,c=22,h=46,w=34 ; After Configure, The data formats were reformatted to nchw8c which was not ideal case. As the output cannot be converted into nchw8c format. These inputs and outputs should be of data format nchw after the configure which was happening in v0.14

BhaskarsarmaP avatar Jan 11 '19 13:01 BhaskarsarmaP

Hi @BhaskarsarmaP,

Did you create convolution with fixed format (dst_desc.format = nchw) or any, as recommended for performance reasons (dst_desc.format = any)? If latter is the case, then the fact that Intel MKL-DNN picks the nChw8c is pretty valid.

Could you please post the code that shows the issue?

emfomenk avatar Jan 11 '19 13:01 emfomenk

We have used 'any' for optimization purpose . However the output channel size is 22 which is not multiple of 8 . So the Convolution should fallback to nchw instead of operating on nChw8c . Note: In v14 the same convolution is operating with nchw for both input and output.

BhaskarsarmaP avatar Jan 11 '19 13:01 BhaskarsarmaP

Starting with v0.15 Intel MKL-DNN supports padding. So 22 channels would be rounded up to 24 so that optimized jitted convolution is used. This should be more or less transparent to user. The only pitfall is that allocation should be done for appropriate size (which is bigger than just product of logical dimensions). However if a user uses mkldnn_memory_primitive_get_size() everything should be fine.

The information about padded format can be found in this article.

emfomenk avatar Jan 11 '19 13:01 emfomenk

Ok Thanks for the Information

BhaskarsarmaP avatar Jan 11 '19 13:01 BhaskarsarmaP