Logging stuffs (#17177)
authorYing Zhang <yingz@fb.com>
Sun, 17 Feb 2019 21:39:08 +0000 (13:39 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sun, 17 Feb 2019 21:41:50 +0000 (13:41 -0800)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17177

Add more logging and flag.

Reviewed By: yinghai

Differential Revision: D14111643

fbshipit-source-id: 4b1c005faf41c21f59100bc401120c6970a24c42

caffe2/opt/onnxifi_transformer.cc

index aa7c425..c2b570a 100644 (file)
@@ -499,6 +499,9 @@ NetDef OnnxifiTransformer::SubnetToOnnxifiOpViaC2(
   // Debugging stuff
   if (opts_.debug) {
     WriteProtoToTextFile(
+        net,
+        "debug_original_net_" + c10::to_string(onnxifi_op_id_) + ".pb_txt");
+    WriteProtoToTextFile(
         onnxifi_net,
         "debug_onnxifi_net_" + c10::to_string(onnxifi_op_id_) + ".pb_txt");
     WriteProtoToTextFile(
@@ -903,6 +906,11 @@ void OnnxifiTransformer::transform(
 
   // Need to figure out a proper place to handle device option
   net_opt.mutable_device_option()->CopyFrom(pred_net->device_option());
+
+  if (opts_.debug) {
+    WriteProtoToTextFile(*pred_net, "debug_full_pred_net.pb_txt");
+    WriteProtoToTextFile(net_opt, "debug_full_opt_net.pb_txt");
+  }
   pred_net->Swap(&net_opt);
 }