You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/12/06 10:17:30 UTC
[GitHub] [tvm] mkroening opened a new issue #9656: [Bug] TVMC tune: Broadcast exception on valid ONNX model
mkroening opened a new issue #9656:
URL: https://github.com/apache/tvm/issues/9656
### Expected behavior
No issue when running
```console
tvmc tune --target llvm --output autotuner_records.json model.onnx
```
with the ONNX model only being a multiplication of two four by four matrices (three by three works).
Note that compiling the model without tuning works and produces valid results.
Model:
```onnx
ir_version: 8
graph {
node {
input: "A"
input: "B"
output: "Y"
op_type: "Gemm"
}
name: "test-model"
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 4
}
dim {
dim_value: 4
}
}
}
}
}
input {
name: "B"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 4
}
dim {
dim_value: 4
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 4
}
dim {
dim_value: 4
}
}
}
}
}
}
opset_import {
version: 15
}
```
### Actual behavior
```
# [..]
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/mkroening/Development/tvm/python/tvm/driver/tvmc/__main__.py", line 24, in <module>
tvmc.main.main()
File "/home/mkroening/Development/tvm/python/tvm/driver/tvmc/main.py", line 100, in main
sys.exit(_main(sys.argv[1:]))
File "/home/mkroening/Development/tvm/python/tvm/driver/tvmc/main.py", line 93, in _main
return args.func(args)
File "/home/mkroening/Development/tvm/python/tvm/driver/tvmc/autotuner.py", line 266, in drive_tune
tune_model(
File "/home/mkroening/Development/tvm/python/tvm/driver/tvmc/autotuner.py", line 486, in tune_model
tune_tasks(tasks, tuning_records, **tuning_options)
File "/home/mkroening/Development/tvm/python/tvm/driver/tvmc/autotuner.py", line 687, in tune_tasks
tuner_obj.tune(
File "/home/mkroening/Development/tvm/python/tvm/autotvm/tuner/xgboost_tuner.py", line 105, in tune
super(XGBTuner, self).tune(*args, **kwargs)
File "/home/mkroening/Development/tvm/python/tvm/autotvm/tuner/tuner.py", line 169, in tune
self.update(inputs, results)
File "/home/mkroening/Development/tvm/python/tvm/autotvm/tuner/model_based_tuner.py", line 281, in update
self.cost_model.fit(self.xs, self.ys, self.plan_size)
File "/home/mkroening/Development/tvm/python/tvm/autotvm/tuner/xgboost_cost_model.py", line 179, in fit
x_train = self._get_feature(xs)
File "/home/mkroening/Development/tvm/python/tvm/autotvm/tuner/xgboost_cost_model.py", line 341, in _get_feature
ret[i, :] = t if t is not None else 0
ValueError: could not broadcast input array from shape (468,) into shape (426,)
Done.
```
### Environment
Operating System: Ubuntu 20.04.3 LTS
TVM version: ccd59e89d21cc81cc06f2a16cddcc1ffeed1e2a1
### Steps to reproduce
Create `model.onnx` with:
```python
import onnx
from onnx import helper
from onnx import TensorProto
l = 4
m = 4
n = 4
A = helper.make_tensor_value_info('A', TensorProto.FLOAT, [l, m])
B = helper.make_tensor_value_info('B', TensorProto.FLOAT, [m, n])
Y = helper.make_tensor_value_info('Y', TensorProto.FLOAT, [l, n])
node_def = helper.make_node(
'Gemm', # name
['A', 'B'], # inputs
['Y'], # outputs
)
graph_def = helper.make_graph(
[node_def], # nodes
'test-model', # name
[A, B], # inputs
[Y], # outputs
)
model_def = helper.make_model(graph_def)
print('The model is:\n{}'.format(model_def))
onnx.checker.check_model(model_def)
print('The model is checked!')
onnx.save(model_def, 'model.onnx')
```
Thanks a lot for your help! :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org