microsoft / microsoft/onnxruntime

No implementation for Where(9)

Open
#9,539 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 8h
Merged PRs (30d)
179

Description

Describe the bug
[ONNXRuntimeError] : 9 : NOT_IMPLEMENTED : Could not find an implementation for Where(9) node with name 'Where_16' is raised when updating a boolean tensor.

Urgency
None

System information

  • OS Platform and Distribution: Windows 10
  • ONNX Runtime installed from: binary
  • ONNX Runtime version: 1.9.0
  • Python version: 3.8
  • Visual Studio version (if applicable): 2019
  • GCC/Compiler version (if compiling from source): N/A
  • CUDA/cuDNN version: 11.1
  • GPU model and memory: GTX 3080 Ti, 12 GB

To Reproduce

import torch
import torch.nn as nn
import onnxruntime as ort


class Model(nn.Module):
    def forward(self, x):
        candidate = torch.rand(x.size(0), device=x.device) < 0.5
        candidate[x == 0] = False
        return candidate


def main():
    dummy_input = torch.randint(256, (256,), dtype=torch.int32)
    model = Model()
    input_names = ['x']
    output_names = ['candidate']
    torch.onnx.export(model, dummy_input, 'm.onnx', verbose=True,
                      input_names=input_names, output_names=output_names,
                      dynamic_axes={
                          'x': {0: 'len'},
                          'candidate': {0: 'len'}
                      }, opset_version=13)
    ort_session = ort.InferenceSession('m.onnx')


if __name__ == '__main__':
    main()

Please also find the onnx model here: m.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided Python reproduction and the attached m.onnx model, then inspect how the runtime handles the Where(9) node when updating a boolean tensor. Done means the InferenceSession loads the model and executes the boolean update without the NOT_IMPLEMENTED error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.