mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-24 19:43:35 +00:00
symbolic shape inference: fix warnings in GPT-2 model (#2608)
And revise nuphar perf test on BERT squad
This commit is contained in:
parent
bc89eccb21
commit
45babd6c00
2 changed files with 10 additions and 5 deletions
|
|
@ -263,7 +263,13 @@ class SymbolicShapeInference:
|
|||
else:
|
||||
new_dim = self._merge_symbols([dim1, dim2])
|
||||
if not new_dim:
|
||||
print('unsupported broadcast between ' + str(dim1) + ' ' + str(dim2))
|
||||
# warning about unsupported broadcast when not auto merge
|
||||
# note that auto merge has the risk of incorrectly merge symbols while one of them being 1
|
||||
# for example, 'a' = 1, 'b' = 5 at runtime is valid broadcasting, but with auto merge 'a' == 'b'
|
||||
if self.auto_merge_:
|
||||
self._add_suggested_merge([dim1, dim2], apply=True)
|
||||
else:
|
||||
print('unsupported broadcast between ' + str(dim1) + ' ' + str(dim2))
|
||||
new_shape = [new_dim] + new_shape
|
||||
return new_shape
|
||||
|
||||
|
|
@ -625,9 +631,9 @@ class SymbolicShapeInference:
|
|||
sympy_shape = self._get_int_values(node)[0]
|
||||
vi = self.known_vi_[node.output[0]]
|
||||
if sympy_shape is not None:
|
||||
self._update_computed_dims(sympy_shape)
|
||||
if type(sympy_shape) != list:
|
||||
sympy_shape = [sympy_shape]
|
||||
self._update_computed_dims(sympy_shape)
|
||||
else:
|
||||
# create new dynamic shape
|
||||
sympy_shape = self._new_symbolic_shape(self._get_shape_rank(node,0), node)
|
||||
|
|
|
|||
|
|
@ -108,10 +108,9 @@ class TestNuphar(unittest.TestCase):
|
|||
onnx_test_runner = os.path.join(cwd, 'onnx_test_runner')
|
||||
subprocess.run([onnx_test_runner, '-e', 'nuphar', '-n', 'download_sample_10', cwd], check=True, cwd=cwd)
|
||||
|
||||
# run onnxruntime_perf_test
|
||||
# run onnxruntime_perf_test, note that nuphar currently is not integrated with ORT thread pool, so set -x 1 to avoid thread confliction with OpenMP
|
||||
onnxruntime_perf_test = os.path.join(cwd, 'onnxruntime_perf_test')
|
||||
subprocess.run([onnxruntime_perf_test, '-e', 'nuphar', '-t', '20', bert_squad_model, '1.txt'], check=True, cwd=cwd)
|
||||
subprocess.run([onnxruntime_perf_test, '-e', 'cpu', '-o', '99', '-t', '20', bert_squad_model, '1.txt'], check=True, cwd=cwd)
|
||||
subprocess.run([onnxruntime_perf_test, '-e', 'nuphar', '-x', '1', '-t', '20', bert_squad_model, '1.txt'], check=True, cwd=cwd)
|
||||
|
||||
|
||||
def test_rnn_benchmark(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue