expose graph node name returning non-zero status code (#714)

* Initial commit
This commit is contained in:
Hariharan Seshadri 2019-04-05 12:50:58 -07:00 committed by GitHub
parent f4021cf30a
commit ffd9071168
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View file

@ -152,7 +152,11 @@ namespace Microsoft.ML.OnnxRuntime.Tests
var tensor = new DenseTensor<float>(inputData, new int[] { 1, 3 });
container.Add(NamedOnnxValue.CreateFromTensor<float>("data_0", tensor));
var ex = Assert.Throws<OnnxRuntimeException>(() => session.Run(container));
Assert.Equal("[ErrorCode:Fail] X num_dims does not match W num_dims. X: {1,3} W: {64,3,3,3}", ex.Message);
Assert.True(
!string.IsNullOrEmpty(ex.Message) &&
ex.Message.StartsWith("[ErrorCode:Fail]") &&
ex.Message.Contains("X num_dims does not match W num_dims. X: {1,3} W: {64,3,3,3}")
);
session.Dispose();
}

View file

@ -6,6 +6,7 @@
#include <chrono>
#include <thread>
#include <vector>
#include <sstream>
#include "core/common/common.h"
#include "core/common/logging/logging.h"
#include "core/framework/allocation_planner.h"
@ -112,7 +113,18 @@ Status SequentialExecutor::Execute(const SessionState& session_state,
kernel_begin_time = session_state.Profiler().StartTime();
}
ORT_RETURN_IF_ERROR(p_op_kernel->Compute(&op_kernel_context));
const auto& compute_status = p_op_kernel->Compute(&op_kernel_context);
if (!compute_status.IsOK()) {
std::ostringstream ss;
ss << "Non-zero status code returned while running Node: " <<
p_op_kernel->Node().Name() <<
" Status Message: " <<
compute_status.ErrorMessage();
const auto msg_string = ss.str();
LOGS(logger, ERROR) << msg_string;
return Status(compute_status.Category(), compute_status.Code(), msg_string);
}
if (f_profiler_enabled) {
session_state.Profiler().EndTimeAndRecordEvent(profiling::NODE_EVENT,