mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-26 19:52:38 +00:00
Enforce If condition size == 1 (#18733)
### Description <!-- Describe your changes. --> ### Motivation and Context https://github.com/microsoft/onnxruntime/issues/18549
This commit is contained in:
parent
9479ba525b
commit
e603e78627
1 changed files with 6 additions and 1 deletions
|
|
@ -248,7 +248,12 @@ Status If::Compute(OpKernelContext* ctx) const {
|
|||
|
||||
auto ctx_internal = static_cast<OpKernelContextInternal*>(ctx);
|
||||
|
||||
auto condition = *ctx->Input<Tensor>(0)->Data<bool>();
|
||||
const auto& condition_tensor = *ctx->Input<Tensor>(0);
|
||||
|
||||
ORT_RETURN_IF_NOT(condition_tensor.Shape().Size() == 1,
|
||||
"If nodes condition input must have exactly one element");
|
||||
|
||||
auto condition = *condition_tensor.Data<bool>();
|
||||
|
||||
auto attribute = condition ? "then_branch" : "else_branch";
|
||||
auto* session_state = ctx_internal->SubgraphSessionState(attribute);
|
||||
|
|
|
|||
Loading…
Reference in a new issue