Skip to content

Commit

Permalink
[Analysis] add "" tensor exception in all_tensors_f32
Browse files Browse the repository at this point in the history
  • Loading branch information
maltanar committed Dec 17, 2024
1 parent ac15c7d commit 76bd715
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/qonnx/analysis/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ def all_tensors_f32(model):
annotations notwithstanding.
Returns {"all_tensors_f32": Bool}."""
all_tensors = model.make_empty_exec_context().items()
exec_ctx = model.make_empty_exec_context()
# remove the special empty string entry in the context since it has no tensor
exec_ctx.pop("")
all_tensors = exec_ctx.items()
non_f32_tensors = filter(lambda x: x[1].dtype != np.float32, all_tensors)
return {"all_tensors_f32": len(list(non_f32_tensors)) == 0}

Expand Down

0 comments on commit 76bd715

Please sign in to comment.