Last active
March 22, 2020 15:19
-
-
Save dboyliao/c1a78afa23a9bc3b8c092148521ad78b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from utensor_cgen.backend.graph_lower import TensorAllocationPlanner | |
from utensor_cgen.frontend.tensorflow import GraphDefParser | |
parser = GraphDefParser(config={}) | |
planner = TensorAllocationPlanner(config={}) | |
ugraph = parser.parse('tests/deep_mlp/simple_mnist.pb', output_nodes=['y_pred']) | |
planner.apply(ugraph) | |
plan = ugraph.attributes[planner.KWARGS_NAMESCOPE].plan | |
total_size = ugraph.attributes[planner.KWARGS_NAMESCOPE].total_size | |
for tensor_name, alloc in plan.items(): | |
print(f'{tensor_name!r}', f'memory offset: {alloc.offset_start}, size: {alloc.size}') | |
print('total memory usage:', total_size) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment