Is it possible to make mkldnn_nchw == mkldnn_oihw in value? (and 2 other group)
The rationale is that several frameworks create tensor without knowing its purpose. It might be weights or inputs/outputs until actual operator. From MKL-DNN's perspective these formats are equivalent when initializing and manipulating.
Hi @4pao,
Good question. Eventually this is something that should happen.
In fact, mkldnn_nchw and all the other aliases should be used only on user side to specify the initial data layout. The problem is that unfortunately this abstraction is leaked to MKL-DNN internals and now it is not that easy to get rid of it.
One of the really minor thing that prevents us to do that right now is -Wall -Werror. As long as we want to use two enums with the same values we need to be really careful with ifs and switches, since the code below would generate warning (and hence trigger an error):
swich (layout) {
case mkldnn_nchw: ...;
case mkldnn_oihw: ...; // the same, duplicating
};
Other than that I probably don't see any problems...
Hi @emfomenk,
Hmmm, that's minor issue. The real problem is grouped format.
Could you please elaborate?
@emfomenk Consider we've done making iohw == nchw, then we created two memory with nchw but at this time we used these memory object in an operator which had group number 2, we should use goihw to initialize the format. Can we make goihw == nchw too?
No way. goihw is 5D tensor while nchw or oihw are 4D tensor.
// update: actually maybe no so "no way"... hmm...
Oh, then creating 5D tensor means we want grouped weights. It doesn't need to merge these format. That's a relief. I did a test that make oihw == nchw, changed a few line of code, make it pass build and it pass all MKL-DNN tests. Conceptually, these two terms can merge.
Yeah, conceptually nothing is preventing us from doing that.
This is also aligned with (easy) bullet in this comment.