Merged PR 5065263: ONNX backend autopilot crash in WinML ToString running test_cast_BFLOAT16_to_FLOAT

While attempting to throw an error and format an error message about an incompatible binding, WinML dies via FAIL_FAST_IF_MSG because the helper `ToString` function itself croaks :b. Instead, it should just say the data type is undefined.

```
StartGroup: Test:#62; Graph:test_cast_BFLOAT16_to_FLOAT; Executor:WinMLOperatorExecutor_Cpu;
TAEF: A crash with exception code 0xC0000409 occurred in module "Windows.AI.MachineLearning.dll" in process "te.processhost.exe" (pid:15732).
Error: TAEF: [HRESULT 0x800706BE] A failure occurred while running a test operation: 'OnnxConformanceTestsTaef::OnnxBackend'. (A crash with exception code 0xC0000409 occurred in module "Windows.AI.MachineLearning.dll" in the process hosting the test code while invoking a test operation.)
```
This commit is contained in:
Dwayne Robinson 2020-08-20 21:20:37 +00:00
parent 40324e6f77
commit 730d95107d

View file

@ -54,9 +54,10 @@ static std::string ToString(wfc::IVectorView<int64_t> shape) {
static std::string ToString(
winml::TensorKind kind,
wfc::IVectorView<int64_t> shape) {
FAIL_FAST_IF_MSG(kind == winml::TensorKind::Complex128, "Unexpected TensorKind Complex128.");
FAIL_FAST_IF_MSG(kind == winml::TensorKind::Complex64, "Unexpected TensorKind Complex64.");
FAIL_FAST_IF_MSG(kind == winml::TensorKind::Undefined, "Unexpected TensorKind Undefined.");
// Any unrecognized data type is considered "Undefined".
if (static_cast<uint32_t>(kind) >= std::size(SzTensorKind)) {
kind = winml::TensorKind::Undefined;
}
std::ostringstream stream;
stream << SzTensorKind[static_cast<uint32_t>(kind)] << ToString(shape);
@ -73,9 +74,10 @@ static std::string ToString(winml::ITensor value) {
static std::string ToString(winml::IMapFeatureDescriptor descriptor) {
auto keyKind = descriptor.KeyKind();
FAIL_FAST_IF_MSG(keyKind == winml::TensorKind::Complex128, "Unexpected TensorKind Complex128.");
FAIL_FAST_IF_MSG(keyKind == winml::TensorKind::Complex64, "Unexpected TensorKind Complex64.");
FAIL_FAST_IF_MSG(keyKind == winml::TensorKind::Undefined, "Unexpected TensorKind Undefined.");
// Any unrecognized data type is considered "Undefined".
if (static_cast<uint32_t>(keyKind) >= std::size(SzTensorKind)) {
keyKind = winml::TensorKind::Undefined;
}
auto valueDescriptor = descriptor.ValueDescriptor();
std::ostringstream stream;
@ -86,9 +88,10 @@ static std::string ToString(winml::IMapFeatureDescriptor descriptor) {
static std::string ToString(winrt::com_ptr<_winml::IMapFeatureValue> value) {
winml::TensorKind keyKind;
FAIL_FAST_IF_FAILED(value->get_KeyKind(&keyKind));
FAIL_FAST_IF_MSG(keyKind == winml::TensorKind::Complex128, "Unexpected TensorKind Complex128.");
FAIL_FAST_IF_MSG(keyKind == winml::TensorKind::Complex64, "Unexpected TensorKind Complex64.");
FAIL_FAST_IF_MSG(keyKind == winml::TensorKind::Undefined, "Unexpected TensorKind Undefined.");
// Any unrecognized data type is considered "Undefined".
if (static_cast<uint32_t>(keyKind) >= std::size(SzTensorKind)) {
keyKind = winml::TensorKind::Undefined;
}
winml::ILearningModelFeatureDescriptor valueDescriptor;
FAIL_FAST_IF_FAILED(value->get_ValueDescriptor(&valueDescriptor));