mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
Fix a bug that constant folding doesn't check the returned value of OpKernel::Compute (#1243)
This commit is contained in:
parent
723e30b361
commit
f22d1df04f
3 changed files with 5 additions and 5 deletions
|
|
@ -40,10 +40,9 @@ class OpKernel {
|
|||
return op_kernel_info_.GetKernelDef();
|
||||
}
|
||||
|
||||
virtual Status Compute(OpKernelContext* context) const = 0;
|
||||
virtual Status Compute(OpKernelContext* context) const ORT_MUST_USE_RESULT = 0;
|
||||
|
||||
virtual Status ComputeAsync(OpKernelContext*,
|
||||
DoneCallback) const {
|
||||
virtual Status ComputeAsync(OpKernelContext*, DoneCallback) const ORT_MUST_USE_RESULT {
|
||||
ORT_NOT_IMPLEMENTED(__FUNCTION__, " is not implemented");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ Status ConstantFolding::ApplyImpl(Graph& graph, bool& modified, int graph_level)
|
|||
auto* kernel = info.GetKernel(node->Index());
|
||||
OpKernelContext op_kernel_context(&frame, kernel, ::onnxruntime::logging::LoggingManager::DefaultLogger());
|
||||
|
||||
kernel->Compute(&op_kernel_context);
|
||||
ORT_RETURN_IF_ERROR(kernel->Compute(&op_kernel_context));
|
||||
|
||||
std::vector<OrtValue> fetches;
|
||||
frame.GetOutputs(fetches);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ TEST(OptimizerTest, Basic) {
|
|||
|
||||
OpKernelContext op_kernel_context(&frame, kernel, logger);
|
||||
|
||||
kernel->Compute(&op_kernel_context);
|
||||
auto st = kernel->Compute(&op_kernel_context);
|
||||
ASSERT_TRUE(st.IsOK()) << st.ErrorMessage();
|
||||
|
||||
std::vector<OrtValue> fetches;
|
||||
frame.GetOutputs(fetches);
|
||||
|
|
|
|||
Loading…
Reference in a new issue