Skip to content

shape_optimizer: dump GraphDef as .pbtxt before and after optimization pass - #6

Draft
fenxcc with Copilot wants to merge 2 commits into
masterfrom
copilot/add-logging-for-shape-optimizer
Draft

shape_optimizer: dump GraphDef as .pbtxt before and after optimization pass#6
fenxcc with Copilot wants to merge 2 commits into
masterfrom
copilot/add-logging-for-shape-optimizer

Conversation

Copilot AI commented Apr 2, 2026

Copy link
Copy Markdown

Adds debug graph dumping to ShapeOptimizer::Optimize so the input and output GraphDef can be inspected as .pbtxt files around the optimization pass.

Changes

  • shape_optimizer.cc: Include dump_graph.h and add two DumpGraphDefToFile calls guarded by VLOG_IS_ON(1):
    • Before optimization: dumps item.graph as before_ShapeOptimizer_<item.id>.pbtxt
    • After optimization: dumps *optimized_graph as after_ShapeOptimizer_<item.id>.pbtxt

Usage

# Write .pbtxt files to /tmp/graphs/
TF_DUMP_GRAPH_PREFIX=/tmp/graphs TF_CPP_MIN_VLOG_LEVEL=1 <your_binary>

# Or log graph text to stderr
TF_DUMP_GRAPH_PREFIX=- TF_CPP_MIN_VLOG_LEVEL=1 <your_binary>

item.id is used as the filename discriminator so before/after pairs are trivially correlated and multiple optimization runs don't collide. Follows the same pattern used in meta_optimizer.cc.

Copilot AI changed the title [WIP] Add logging for shape optimizer before and after optimization shape_optimizer: dump GraphDef as .pbtxt before and after optimization pass Apr 2, 2026
Copilot AI requested a review from fenxcc April 2, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants