Skip to content
Snippets Groups Projects
Commit d2be2418 authored by auphelia's avatar auphelia
Browse files

[Analysis pass] Added resource estimation analysis pass

parent 1921e7f9
No related branches found
No related tags found
No related merge requests found
import finn.custom_op.registry as registry
import finn.core.utils as util
def res_estimation(model):
"""Estimates the resources needed for the given model.
Returns {node op_type : resource estimation}"""
res_dict = {}
for node in model.graph.node:
if node.domain == "finn":
backend_attribute = util.get_by_name(node.attribute, "backend")
if backend_attribute is None:
continue
backend_value = backend_attribute.s.decode("UTF-8")
if backend_value == "fpgadataflow":
op_type = node.op_type
inst = registry.custom_op[op_type](node)
res_dict[op_type] = inst.node_res_estimation()
return res_dict
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment