Include function name and code in the graph debug info.
This patch also makes the other two changes to reduce the overhead of
generating graph debug information:
- reduce the level of stack traces to 3 lines. We found 3 lines is sufficient
to identify how the node is created at runtime (see the example);
- remove the sorting of the unique file names.
After the change, saving the debug information when training mobilenet v2 can
take as much as 10 mins on a desktop machine. The produced graph debug
information file is about 17.5 M in binary format.
Example:
One of the Conv2D node from the train graph of mobilenet v2:
```
traces {
key: "MobilenetV2/Conv/Conv2D"
value {
file_line_cols {
file_index: 26
line: 1156
func: "convolution2d"
code: "conv_dims=2)"
}
file_line_cols {
file_index: 4
line: 182
func: "func_with_args"
code: "return func(*args, **current_args)"
}
file_line_cols {
file_index: 28
line: 278
func: "mobilenet_base"
code: "net = opdef.op(net, **params)"
}
file_line_cols {
file_index: 4
line: 182
func: "func_with_args"
code: "return func(*args, **current_args)"
}
file_line_cols {
file_index: 28
line: 359
func: "mobilenet"
code: "net, end_points = mobilenet_base(inputs, scope=scope, **mobilenet_args)"
}
file_line_cols {
file_index: 4
line: 182
func: "func_with_args"
code: "return func(*args, **current_args)"
}
file_line_cols {
file_index: 32
line: 164
func: "mobilenet"
code: "**kwargs)"
}
file_line_cols {
file_index: 4
line: 182
func: "func_with_args"
code: "return func(*args, **current_args)"
}
file_line_cols {
file_index: 45
line: 93
func: "network_fn"
code: "return func(images, num_classes, is_training=is_training, **kwargs)"
}
file_line_cols {
file_index: 5
line: 165
func: "build_model"
code: "inputs, depth_multiplier=FLAGS.depth_multiplier)"
}
}
}
```
PiperOrigin-RevId: 233663996
Loading
Please sign in to comment