Skip to content

Commit

Permalink
fix: fix export test value bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
100312dog committed Dec 23, 2024
1 parent 5428134 commit 10d6d37
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ppq/parser/espdl/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def make_graph_test_value(
input_value = input_value.flatten()
if len(input_shape) == 0:
input_shape = [1]
input_value_fbs = make_tensor(input_name, tensor_type, input_shape, input_value.tobytes(), raw=True,
input_value_fbs = make_tensor(input_name, tensor_type, input_shape, input_value, raw=True,
exponents=var_exponents)
input_test_values.append(input_value_fbs)

Expand All @@ -183,7 +183,7 @@ def make_graph_test_value(
output_value = output_value.flatten()
if len(output_shape) == 0:
output_shape = [1]
output_value_fbs = make_tensor(output_name, tensor_type, output_shape, output_value.tobytes(), raw=True,
output_value_fbs = make_tensor(output_name, tensor_type, output_shape, output_value, raw=True,
exponents=var_exponents)
output_test_values.append(output_value_fbs)

Expand Down
1 change: 1 addition & 0 deletions ppq/parser/espdl_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ def build_variable_proto(
value.item(),
] # it is fine for onnx, shape for this value will be []
var_shape = torch.tensor(value).shape
is_raw_format = True
else:
value = value # value is python primary type.
tensor_proto = helper.make_tensor(
Expand Down

0 comments on commit 10d6d37

Please sign in to comment.