Skip to content

Commit a3c1aa3

Browse files
ai-edge-botcopybara-github
authored andcommitted
Fix zero-size array crash in validator.
PiperOrigin-RevId: 755072823
1 parent d56a83d commit a3c1aa3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ai_edge_quantizer/model_validator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,9 @@ def compare_model(
306306
for tensor_name, detail in ref_tensor_name_to_details.items():
307307
if detail['dtype'] == np.object_:
308308
continue
309+
# Ignore tensors where any dimension of the shape is 0.
310+
if not np.all(detail['shape']):
311+
continue
309312
if tensor_name in targ_tensor_name_to_details:
310313
if tensor_name not in comparison_results:
311314
comparison_results[tensor_name] = []

0 commit comments

Comments
 (0)