jiazhihao / TASO

The Tensor Algebra SuperOptimizer for Deep Learning
Apache License 2.0
692 stars 90 forks source link

xf.export_onnx error #18

Closed yaoyaoding closed 5 years ago

yaoyaoding commented 5 years ago

Hi,

Thanks for the great work. I meet a problem during using the code.

To export the optimized nasrnn model, I add the three lines at the end of examples/nasrnn.py:

onnx_model = xf.export_onnx(new_graph)
onnx.checker.check_model(onnx_model)
onnx.save(onnx_model, "nasrnn_opt_xflow.onnx")

Then run the command $ python examples/nasrnn.py. The program gives the following error message on function xf.export_onnx(new_graph):

......
        cost[Concat]: numInputs(2) cost(0.0001) total_cost(1.3592)
        cost[Matmul]: input(1:1024 1024:1) weight(1024:512 512:1) cost(0.0116) total_cost(1.3708)
        Cost metrics: exe_time(1.3708) flops(0.0196) memory_access(0.4395) kernel_launches(190)
op.guid=53520 mytype=Concat inedges=2
Traceback (most recent call last):
  File "examples/nasrnn.py", line 36, in <module>
    onnx_model = xf.export_onnx(new_graph)
  File "/home/yaoyao/anaconda3/lib/python3.7/site-packages/xflow-0.0.0-py3.7-linux-x86_64.egg/xflow/__init__.py", line 277, in export_onnx
    inputs.append(_input_tensor_name(graph, e, op))
  File "/home/yaoyao/anaconda3/lib/python3.7/site-packages/xflow-0.0.0-py3.7-linux-x86_64.egg/xflow/__init__.py", line 240, in _input_tensor_name
    return "{}{}_{}".format(mytype, op['guid'], input_weight_names[mytype][inedge['dstIdx']])
KeyError: 'Concat'

Thanks a lot if you can help!

jiazhihao commented 5 years ago

@idy002 Thanks for reporting the issue. The problem should have been fixed in commit 63e061a.

yaoyaoding commented 5 years ago

Thanks for your fix! Now it works normally~ :smile: