-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support non-spatial mode in BatchNormalization #2092
Conversation
@@ -532,7 +532,6 @@ int real_main(int argc, char* argv[], Ort::Env& env) { | |||
#endif | |||
|
|||
#ifdef USE_CUDA | |||
broken_tests.insert({"mxnet_arcface", "result mismatch"}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added to the exclusion list once above
@@ -319,7 +319,7 @@ private void TestMultiThreads() | |||
private static Dictionary<string, string> GetSkippedModels() | |||
{ | |||
var skipModels = new Dictionary<string, string>() { | |||
{ "mxnet_arcface", "Model not supported by CPU execution provider" } , | |||
{ "mxnet_arcface", "Model is an invalid ONNX model", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See reply here on why it is invalid:
onnx/models#156
//constexpr int kMinCudaNumDims = 4; | ||
//constexpr int kMaxCudaNumDims = 5; | ||
|
||
if (X->Shape().GetDims().empty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this check in favor of the more stricter check in line 20.
const Tensor* var, | ||
bool is_spatial = true) { | ||
const auto& x_dims = X->Shape().GetDims(); | ||
if (x_dims.size() < 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though, the spec doesn't explicitly state it, it makes sense if the minimum rank of 'X' is atleast 3 - N,C, and atleast one data dimension (D1). However, when we impose that, it seems to break some successfully running models that have input rank 2 - [N, C]. The implicit shape is [N, C, 1] in these cases and the results seem ok. Hence, modifying the minimum rank criteria to just 2. This is necessary to add as in the next step we parse the number of channels from the index position 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description: Older opset spec of BatchNormalization supports non-spatial mode of the operator supported by some frameworks. This change supports that mode of operation.
Motivation and Context
Keep ORT backwards compatible