You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/09/08 05:33:43 UTC

[GitHub] [tvm] idoudali commented on a change in pull request #8668: [Draft PR] Visualization Relay IR on terminal

idoudali commented on a change in pull request #8668:
URL: https://github.com/apache/tvm/pull/8668#discussion_r704060404



##########
File path: python/tvm/contrib/relay_viz/__init__.py
##########
@@ -0,0 +1,128 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Relay IR Visualizer"""
+import logging
+import copy
+from tvm import relay
+from enum import Enum
+
+_LOGGER = logging.getLogger(__name__)
+
+class PlotterBackend(Enum):
+    """Enumeration for available plotters."""
+
+    BOKEH = "bokeh"
+    TERMINAL = "terminal"
+
+
+class RelayVisualizer:
+    """Relay IR Visualizer"""
+
+    def __init__(
+        self, relay_mod, relay_param=None, backend=PlotterBackend.BOKEH

Review comment:
       Could we change the interface and allow backend to be a union:
   * Either a string of the backend name
   * Or a tuple of plotter, render_rules objects ? 
   
   This way we can avoid having to implement any new visualizers under this folder and registering them in the get_plotter_and_render_cb function.
   
   A custom visualizer could be written as an external tool to the TVM repo that implements the necessary Plotter/Graph interfaces and imports this code.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org