Also elide large array attribute in OpGraph Dump
authorJing Pu <jingpu@google.com>
Mon, 18 Nov 2019 19:27:08 +0000 (11:27 -0800)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Mon, 18 Nov 2019 19:27:43 +0000 (11:27 -0800)
PiperOrigin-RevId: 281114034

mlir/lib/Transforms/ViewOpGraph.cpp

index f080ccd..503a82b 100644 (file)
@@ -96,6 +96,12 @@ std::string DOTGraphTraits<mlir::Block *>::getNodeLabel(mlir::Operation *op,
       continue;
     }
 
+    auto array = attr.second.dyn_cast<mlir::ArrayAttr>();
+    if (array && static_cast<int64_t>(array.size()) > elideIfLarger) {
+      os << "[...]";
+      continue;
+    }
+
     // Print all other attributes.
     attr.second.print(os);
   }