Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onnx_resnet50.ipynb : "Unknown operation: Gather" #379

Closed
ArnaudWald opened this issue Jan 11, 2019 · 4 comments
Closed

onnx_resnet50.ipynb : "Unknown operation: Gather" #379

ArnaudWald opened this issue Jan 11, 2019 · 4 comments

Comments

@ArnaudWald
Copy link

Hello,

I'm running the onnx-ngraph example notebook with the resnet pre-trained model here.

At the 3rd cell i get an error when running models = import_onnx_file('resnet.onnx')

Here is the full error :

ONNX `ai.onnx` opset version 9 is not supported. Falling back to latest supported version: 7

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/usr/local/lib/python3.6/site-packages/ngraph_onnx/onnx_importer/ops_bridge/__init__.py in make_ng_nodes(node_factory, onnx_node)
     39     try:
---> 40         ng_node_factory_function = getattr(node_factory, op_type)
     41     except AttributeError:

AttributeError: module 'ngraph_onnx.onnx_importer.ops_bridge.opset_latest' has no attribute 'Gather'

During handling of the above exception, another exception occurred:

NotImplementedError                       Traceback (most recent call last)
<ipython-input-7-67b1a5109ac6> in <module>
      2 
      3 # Import the ONNX file
----> 4 models = import_onnx_file('resnet.onnx')
      5 
      6 # Create an nGraph runtime environment

/usr/local/lib/python3.6/site-packages/ngraph_onnx/onnx_importer/importer.py in import_onnx_file(filename)
     63     """
     64     onnx_protobuf = onnx.load(filename)
---> 65     return import_onnx_model(onnx_protobuf)

/usr/local/lib/python3.6/site-packages/ngraph_onnx/onnx_importer/importer.py in import_onnx_model(onnx_protobuf)
     51     :return: list of dicts representing ngraph Ops and their inputs
     52     """
---> 53     model = ModelWrapper(onnx_protobuf)
     54     return model.graph.get_ng_model()
     55 

/usr/local/lib/python3.6/site-packages/ngraph_onnx/onnx_importer/model_wrappers.py in __init__(self, model_proto)
     68 
     69         self.node_factory = get_node_factory(opset_version=ai_onnx_opset_version)
---> 70         self.graph = GraphWrapper(model_proto.graph, self)
     71         super(ModelWrapper, self).__init__(model_proto, self.graph)
     72 

/usr/local/lib/python3.6/site-packages/ngraph_onnx/onnx_importer/model_wrappers.py in __init__(self, onnx_proto_instance, model)
     89                             for initializer in self._proto.initializer]
     90         self._initialize_ng_tensors()
---> 91         self._initialize_ng_nodes()
     92 
     93     @lru_cache(maxsize=512)

/usr/local/lib/python3.6/site-packages/ngraph_onnx/onnx_importer/model_wrappers.py in _initialize_ng_nodes(self)
    138         """Create and cache ngraph Op nodes for all operation nodes in the ONNX graph."""
    139         for node in self.node:
--> 140             node.get_ng_nodes_dict()
    141 
    142     def get_input_names(self):  # type: () -> List[str]

/usr/local/lib/python3.6/site-packages/ngraph_onnx/onnx_importer/model_wrappers.py in get_ng_nodes_dict(self)
    314 
    315         output_node_names = self._proto.output
--> 316         output_nodes = make_ng_nodes(self._graph.model.node_factory, self)
    317         for output_name, node in zip(output_node_names, output_nodes):
    318             # Node name equals to unique name only when it just has been created above.

/usr/local/lib/python3.6/site-packages/ngraph_onnx/onnx_importer/ops_bridge/__init__.py in make_ng_nodes(node_factory, onnx_node)
     40         ng_node_factory_function = getattr(node_factory, op_type)
     41     except AttributeError:
---> 42         raise NotImplementedError('Unknown operation: %s', op_type)
     43 
     44     ng_inputs = onnx_node.get_ng_inputs()

NotImplementedError: ('Unknown operation: %s', 'Gather')

I'm running python 3.6, latest versions of onnx, ngraph and ngraph_onnx built from source on Ubuntu 16.04. The example with ngraph-onnx here works fine.

Any ideas where that could come from ? Is the tutorial up-to-date ?

@ukclivecox
Copy link
Contributor

I think the libraries needed at present are

  • torch==0.4.0
  • torchvision==0.2.1

There may need to be some work to update to latest torch.

@ukclivecox
Copy link
Contributor

ukclivecox commented Jan 12, 2019

The problem is ngraph-onnx doesn't support Gather at present. So Torch 1.0.0 must have changed how it exports the ResNet model compared to 0.4.0 and added the Gather operation for some reason.

@ukclivecox
Copy link
Contributor

@DuanraDlaw We have merged #386 If you can test and give us feedback. Thanks!

@ukclivecox
Copy link
Contributor

Closing fixed. Please reopen if issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants