[GitHub] [incubator-tvm] srkreddy1238 commented on a change in pull request #5617: [TENSORFLOW]StatefulPartitionedCall/PartitionedCall Ops support added
srkreddy1238 commented on a change in pull request #5617: URL: https://github.com/apache/incubator-tvm/pull/5617#discussion_r431620598 ## File path: python/tvm/relay/frontend/tensorflow.py ## @@ -2896,15 +2903,29 @@ def _parse_import_prerequisites(self, graph): """ missing_operators = set() for node in graph.node: +try: +from tensorflow.python.framework import op_def_registry Review comment: Hence we don't need this try. We could join it with all tf imports above :) 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] deepakbabel23 commented on a change in pull request #5617: [TENSORFLOW]StatefulPartitionedCall/PartitionedCall Ops support added
deepakbabel23 commented on a change in pull request #5617: URL: https://github.com/apache/incubator-tvm/pull/5617#discussion_r431618598 ## File path: python/tvm/relay/frontend/tensorflow.py ## @@ -2896,15 +2903,29 @@ def _parse_import_prerequisites(self, graph): """ missing_operators = set() for node in graph.node: +try: +from tensorflow.python.framework import op_def_registry Review comment: @srkreddy1238 , Thank you Siva. op_def_registry is part of both 1.x and 2.x versions. So there would not be an exception in this case. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] lichun-wang commented on issue #5673: mxnet group conv not support very well by tvm
lichun-wang commented on issue #5673: URL: https://github.com/apache/incubator-tvm/issues/5673#issuecomment-635132928 sorry, group=32, cost17ms, not group=3 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] mei-ye opened a new issue #5686: [vulkan] Assertion in tir/transforms/lower_thread_allreduce.cc", line 157 TVMError: Check failed: v:
mei-ye opened a new issue #5686: URL: https://github.com/apache/incubator-tvm/issues/5686 Thanks for participating in the TVM community! We use https://discuss.tvm.ai for any general usage questions and discussions. The issue tracker is used for actionable items such as feature proposals discussion, roadmaps, and bug tracking. You are always welcomed to post on the forum first :) Issues that are inactive for a period of time may get closed. We adopt this policy so that we won't lose track of actionable issues that may fall at the bottom of the pile. Feel free to reopen a new one if you feel there is an additional problem that needs attention when an old one gets closed. For bug reports, to help the developer act on the issues, please include a description of your environment, preferably a minimum script to reproduce the problem. For feature proposals, list clear, small actionable items so we can track the progress of the change. Hit assertion in vulkan target. Other targets might have the same issue as well. File "/home/mye/main/incubator-tvm/src/tir/transforms/lower_thread_allreduce.cc", line 157 TVMError: Check failed: v: [repro.zip](https://github.com/apache/incubator-tvm/files/4693446/repro.zip) 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] lixiaoquan commented on a change in pull request #5680: [Relay] Fix dataflow_pattern.rewrite() hang if Match in IR
lixiaoquan commented on a change in pull request #5680: URL: https://github.com/apache/incubator-tvm/pull/5680#discussion_r431558475 ## File path: tests/python/relay/test_dataflow_pattern.py ## @@ -1033,6 +1033,18 @@ def conv_bias_relu(x, w, b): assert pattern2.match(relu) assert tvm.ir.structural_equal(func(x, w, b), pattern2.partition(relu)) +def test_match_match(): +add_pattern = is_op('add')(wildcard(), wildcard()) +class TestRewrite(DFPatternCallback): +def __init__(self): +self.pattern = add_pattern +def callback(self, pre, post, node_map): +return post.args[0] - post.args[1] +mod = tvm.IRModule({}) +tvm.relay.prelude.Prelude(mod) +# Apply rewrite on IR including relay.Match +rewrite(TestRewrite(), mod['tensor_concatenate_int64']) Review comment: I've fixed this 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] FrozenGene commented on pull request #5394: [TFLITE]Quantize & Dequantize op
FrozenGene commented on pull request #5394: URL: https://github.com/apache/incubator-tvm/pull/5394#issuecomment-635069404 THANKS!Merged! 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] FrozenGene merged pull request #5394: [TFLITE]Quantize & Dequantize op
FrozenGene merged pull request #5394: URL: https://github.com/apache/incubator-tvm/pull/5394 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[incubator-tvm] branch master updated: [TFLITE]Quantize & Dequantize op (#5394)
This is an automated email from the ASF dual-hosted git repository. zhaowu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git The following commit(s) were added to refs/heads/master by this push: new 162a29e [TFLITE]Quantize & Dequantize op (#5394) 162a29e is described below commit 162a29e0b82aef9c3013e360a43a4b14c3c652d9 Author: Samuel AuthorDate: Thu May 28 08:40:58 2020 +0530 [TFLITE]Quantize & Dequantize op (#5394) * [TFLITE]Quantize & Dequantize op * Testcases added * Review comment fixed --- python/tvm/relay/frontend/tflite.py | 38 tests/python/frontend/tflite/test_forward.py | 43 2 files changed, 81 insertions(+) diff --git a/python/tvm/relay/frontend/tflite.py b/python/tvm/relay/frontend/tflite.py index cb10ce5..9414314 100644 --- a/python/tvm/relay/frontend/tflite.py +++ b/python/tvm/relay/frontend/tflite.py @@ -75,6 +75,7 @@ class OperatorConverter(object): 'COS': self.convert_cos, 'DEPTH_TO_SPACE': self.convert_depth_to_space, 'DEPTHWISE_CONV_2D': self.convert_depthwise_conv2d, +'DEQUANTIZE': self.convert_dequantize, 'DETECTION_POSTPROCESS': self.convert_detection_postprocess, 'DIV': self.convert_div, 'ELU': self.convert_elu, @@ -112,6 +113,7 @@ class OperatorConverter(object): 'PAD': self.convert_pad, 'POW': self.convert_pow, 'PRELU': self.convert_prelu, +'QUANTIZE': self.convert_quantize, 'REDUCE_ANY': self.convert_reduce_any, 'REDUCE_MAX': self.convert_reduce_max, 'REDUCE_MIN': self.convert_reduce_min, @@ -277,6 +279,8 @@ class OperatorConverter(object): except ImportError: raise ImportError("The tflite package must be installed") +if tensor_type == TensorType.INT8: +return "int8" if tensor_type == TensorType.UINT8: return "uint8" if tensor_type == TensorType.FLOAT32: @@ -2355,6 +2359,40 @@ class OperatorConverter(object): return out +def convert_quantize(self, op): +"""Convert TFLite Quantize""" + +input_tensors = self.get_input_tensors(op) +assert len(input_tensors) == 1, "input tensors length should be 1" +input_tensor = input_tensors[0] +in_expr = self.get_expr(input_tensor.tensor_idx) + +output_tensors = self.get_output_tensors(op) +assert len(output_tensors) == 1, "output tensors length should be 1" +output_tensor = output_tensors[0] + +# The output must be quantized +assert output_tensor.qnn_params +# Quantize the input +out = self.quantize(in_expr, output_tensor) + +return out + +def convert_dequantize(self, op): +"""Convert TFLite Dequantize""" + +input_tensors = self.get_input_tensors(op) +assert len(input_tensors) == 1, "input tensors length should be 1" +input_tensor = input_tensors[0] +in_expr = self.get_expr(input_tensor.tensor_idx) + +# The input must be quantized +assert input_tensor.qnn_params +# Dequantize the input. +out = self.dequantize(in_expr, input_tensor) + +return out + def convert_detection_postprocess(self, op): """Convert TFLite_Detection_PostProcess""" flexbuffer = op.CustomOptionsAsNumpy().tobytes() diff --git a/tests/python/frontend/tflite/test_forward.py b/tests/python/frontend/tflite/test_forward.py index 7a8437a..a68fd90 100644 --- a/tests/python/frontend/tflite/test_forward.py +++ b/tests/python/frontend/tflite/test_forward.py @@ -1565,6 +1565,48 @@ def test_forward_squeeze(): ### +# Quantize/DeQuantize +# --- + +def _test_quantize_dequantize(data): +""" One iteration of quantize and dequantize """ + +# Define a dummy model +data_in = tf.keras.layers.Input(shape=data.shape[1:]) +act_func = tf.keras.layers.Activation('linear') +keras_model = tf.keras.models.Model(data_in, act_func(data_in)) + +# Load the model +converter = interpreter_wrapper.TFLiteConverter.from_keras_model(keras_model) + +# To create quantized values with dynamic range of activations, needs representative dataset +def representative_data_gen(): +for i in range(100): +yield [data] + +converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE] +converter.representative_dataset = representative_data_gen +converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8] +converter.inference_input_type = tf.uint8 +converter.inference_output_type = tf.uint8 + +# Convert the model to TensorFlow Lite format +tflite_model_quant = converter.convert() + +tflite_output = run_tfli
[GitHub] [incubator-tvm] masahi commented on pull request #5676: [DOC] Improve Pattern Language Docs
masahi commented on pull request #5676: URL: https://github.com/apache/incubator-tvm/pull/5676#issuecomment-635068357 Thanks @comaniac @mbrookhart 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[incubator-tvm] branch master updated: [DOC] Improve Pattern Language Docs (#5676)
This is an automated email from the ASF dual-hosted git repository. masahi pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git The following commit(s) were added to refs/heads/master by this push: new f65cc2d [DOC] Improve Pattern Language Docs (#5676) f65cc2d is described below commit f65cc2dbdfdffda377cf2398fe4f6ef8b38c7b1d Author: Cody Yu AuthorDate: Wed May 27 20:07:32 2020 -0700 [DOC] Improve Pattern Language Docs (#5676) * [DOC] Improve Pattern Language Docs * address comments * address comments --- docs/langref/relay_pattern.rst | 234 +++-- 1 file changed, 227 insertions(+), 7 deletions(-) diff --git a/docs/langref/relay_pattern.rst b/docs/langref/relay_pattern.rst index f56d496..c129544 100644 --- a/docs/langref/relay_pattern.rst +++ b/docs/langref/relay_pattern.rst @@ -28,17 +28,35 @@ Such a language is not just useful for building a rewriter but also providing ex In the backend world, we could use the same machinery to build a higher level API using bring your own code generation. This API takes set of patterns describing your hardware capabilities and an external compiler, providing a relatively smooth heterogeneous experience out of the box. -Examples - +Pattern Examples + -There are quite a few properties that are worth matching of operators below we examine how to match tree properties, and expand on some use cases that are not fully explored in the prototype. The first example is a simple case where we want to match one operator with a single input OR another operator with a single input, see the below diagram for a graphical representation and corresponding code:: +There are quite a few properties of operators that are worth matching. Below we examine how to match tree properties, and expand on some use cases that are not fully explored in the prototype. This section +demonstrates how to write patterns. It is recommended to check `tests/python/relay/test_dataflow_pattern.py`_ +for more use cases. + +.. _tests/python/relay/test_dataflow_pattern.py: https://github.com/apache/incubator-tvm/blob/master/tests/python/relay/test_dataflow_pattern.py + +Matching One of Two Ops +*** + +The first example is a simple case where we want to match one operator with a single input OR +another operator with a single input: + +.. code-block:: python def test_match_op_or(): is_add_or_sub = is_op('add') | is_op('subtract') assert is_add_or_sub.match(relay.op.op.get("add")) assert is_add_or_sub.match(relay.op.op.get("subtract")) -The next example is a dense operation with any operator that is marked element-wise:: + +Matching an Op with Attributes +** + +The next example is a dense operation with any operator that is marked element-wise: + +.. code-block:: python def test_no_match_attr(): op = is_op('nn.dense').has_attr({"TOpPattern": K_ELEMWISE}) @@ -47,6 +65,87 @@ The next example is a dense operation with any operator that is marked element-w y = relay.var('y') assert not op_pat.match(relay.op.nn.dense(x, y)) +Here is another example to match an op with a specific attribute: + +.. code-block:: python + +def test_match_data_layout(): +is_conv2d = is_op('nn.conv2d')(wildcard(), wildcard()).has_attr({"data_layout": "NHWC"}) +x = relay.var('x') +y = relay.var('y') +assert not is_conv2d.match(relay.op.nn.conv2d(x, y)) + +Matching an Optional Op +*** + +The next example is matching a pattern with one optional operator. In this pattern, +we can match the graph of conv2d+bias_add+relu or the graph of conv2d+bias_add. + +.. code-block:: python + +def test_match_optional(): +conv_node = is_op('nn.conv2d')(wildcard(), wildcard()) +bias_node = is_op('nn.bias_add')(conv_node, wildcard()) +pat = bias_node.optional(lambda x: is_op('nn.relu')(x)) + +x = relay.var('x') +y = relay.var('y') +z = relay.var('z') +conv2d = relay.op.nn.conv2d(x, y) +bias = relay.op.nn.bias_add(conv2d, z) +assert pat.match(bias) +relu = relay.op.nn.relu(bias) +assert pat.match(relu) + +Matching Non-Call Nodes +*** + +Sometimes we may also want to match a pattern that includes Tuple or TupleGetItem nodes. +Since there are not call nodes, we need to use specific pattern nodes to match them: + +.. code-block:: python + +def test_match_tuple(): +x = relay.var('x') +y = relay.var('y') +z = relay.var('z') +tuple_pattern = TuplePattern((wildcard(), wildcard(), wildcard())) +assert tuple_pattern.match(relay.expr.Tuple((x,y,z))) + +The next example is matching a pattern of batch_norm -> get(0) -> relu: + +.. code-block:: python + +def test_match_tu
[GitHub] [incubator-tvm] masahi merged pull request #5676: [DOC] Improve Pattern Language Docs
masahi merged pull request #5676: URL: https://github.com/apache/incubator-tvm/pull/5676 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] masahi commented on pull request #5683: [PYTORCH]Minor bug fixes
masahi commented on pull request #5683: URL: https://github.com/apache/incubator-tvm/pull/5683#issuecomment-635017710 Can you add tests? Otherwise it's hard to tell what the problems are. Adding BERT to tests sounds interesting. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] kevinthesun commented on a change in pull request #5684: [AutoTVM][TOPI] Fix bifrost spatial packing conv2d auto tune
kevinthesun commented on a change in pull request #5684: URL: https://github.com/apache/incubator-tvm/pull/5684#discussion_r431504200 ## File path: topi/python/topi/bifrost/conv2d.py ## @@ -370,12 +371,7 @@ def _schedule_winograd(cfg, s, op): s[G].compute_inline() eps, _, _, _ = s[U].op.axis y, _, _, _ = s[padded_kernel].op.axis -if autotvm.GLOBAL_SCOPE.in_tuning: -# Kernel transformation will be pre-computed during compilation, so we skip -# this part to make tuning records correct -s[U].pragma(eps, 'debug_skip_region') -s[padded_kernel].pragma(y, 'debug_skip_region') -else: +if not autotvm.GLOBAL_SCOPE.in_tuning: Review comment: Also winograd kernel transformation is different from spatial_pack. We need to have a different path inside winograd compute to generate placeholder. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] kevinthesun commented on a change in pull request #5684: [AutoTVM][TOPI] Fix bifrost spatial packing conv2d auto tune
kevinthesun commented on a change in pull request #5684: URL: https://github.com/apache/incubator-tvm/pull/5684#discussion_r431505903 ## File path: topi/python/topi/bifrost/conv2d.py ## @@ -142,13 +142,14 @@ def _schedule_spatial_pack(cfg, s, output, conv, data_vec, kernel_vec): s[data_vec].unroll(vw) if isinstance(kernel_vec.op, tvm.te.ComputeOp) and kernel_vec.name == 'kernel_vec': +co, ci, kh, kw, vc = s[kernel_vec].op.axis Review comment: Actually I'm not quite sure whether we can directly do this kind of placeholder replacement inside schedule. https://github.com/apache/incubator-tvm/pull/5511 for mali might also has issue. Putting placeholder replacement in compute would be more convenient. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] kevinthesun commented on a change in pull request #5684: [AutoTVM][TOPI] Fix bifrost spatial packing conv2d auto tune
kevinthesun commented on a change in pull request #5684: URL: https://github.com/apache/incubator-tvm/pull/5684#discussion_r431505903 ## File path: topi/python/topi/bifrost/conv2d.py ## @@ -142,13 +142,14 @@ def _schedule_spatial_pack(cfg, s, output, conv, data_vec, kernel_vec): s[data_vec].unroll(vw) if isinstance(kernel_vec.op, tvm.te.ComputeOp) and kernel_vec.name == 'kernel_vec': +co, ci, kh, kw, vc = s[kernel_vec].op.axis Review comment: Actually I'm not quite sure whether we can directly do this kind of placeholder replacement inside schedule. https://github.com/apache/incubator-tvm/pull/5511 for mali might also has issue. Put placeholder replacement in compute would be more convenient. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] kevinthesun commented on a change in pull request #5684: [AutoTVM][TOPI] Fix bifrost spatial packing conv2d auto tune
kevinthesun commented on a change in pull request #5684: URL: https://github.com/apache/incubator-tvm/pull/5684#discussion_r431504200 ## File path: topi/python/topi/bifrost/conv2d.py ## @@ -370,12 +371,7 @@ def _schedule_winograd(cfg, s, op): s[G].compute_inline() eps, _, _, _ = s[U].op.axis y, _, _, _ = s[padded_kernel].op.axis -if autotvm.GLOBAL_SCOPE.in_tuning: -# Kernel transformation will be pre-computed during compilation, so we skip -# this part to make tuning records correct -s[U].pragma(eps, 'debug_skip_region') -s[padded_kernel].pragma(y, 'debug_skip_region') -else: +if not autotvm.GLOBAL_SCOPE.in_tuning: Review comment: Also winograd kernel transformation is different from spatial_pack. We need to have a different path to generate placeholder. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] kevinthesun commented on a change in pull request #5684: [AutoTVM][TOPI] Fix bifrost spatial packing conv2d auto tune
kevinthesun commented on a change in pull request #5684: URL: https://github.com/apache/incubator-tvm/pull/5684#discussion_r431502771 ## File path: topi/python/topi/bifrost/conv2d.py ## @@ -142,13 +142,14 @@ def _schedule_spatial_pack(cfg, s, output, conv, data_vec, kernel_vec): s[data_vec].unroll(vw) if isinstance(kernel_vec.op, tvm.te.ComputeOp) and kernel_vec.name == 'kernel_vec': +co, ci, kh, kw, vc = s[kernel_vec].op.axis Review comment: Looks like this part shares the logic with arm_cpu and mali. We can move this into [conv2d_nchw_spatial_pack compute](https://github.com/apache/incubator-tvm/blob/master/topi/python/topi/arm_cpu/conv2d_spatial_pack.py#L27). An example is in x86 conv2d: https://github.com/apache/incubator-tvm/blob/master/topi/python/topi/x86/conv2d.py#L188-L201 With this method, we can fix mali/arm_cpu/bifrost in one shot. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] comaniac commented on a change in pull request #5676: [DOC] Improve Pattern Language Docs
comaniac commented on a change in pull request #5676: URL: https://github.com/apache/incubator-tvm/pull/5676#discussion_r431503596 ## File path: docs/langref/relay_pattern.rst ## @@ -28,17 +28,34 @@ Such a language is not just useful for building a rewriter but also providing ex In the backend world, we could use the same machinery to build a higher level API using bring your own code generation. This API takes set of patterns describing your hardware capabilities and an external compiler, providing a relatively smooth heterogeneous experience out of the box. -Examples - +Pattern Examples + -There are quite a few properties that are worth matching of operators below we examine how to match tree properties, and expand on some use cases that are not fully explored in the prototype. The first example is a simple case where we want to match one operator with a single input OR another operator with a single input, see the below diagram for a graphical representation and corresponding code:: +There are quite a few properties of operators that are worth matching. Below we examine how to match tree properties, and expand on some use cases that are not fully explored in the prototype. This section +demonstrates how to write patterns. It is recommended to check `tests/python/relay/test_dataflow_pattern.py`_ +for more use cases. + +.. _tests/python/relay/test_dataflow_pattern.py: https://github.com/apache/incubator-tvm/blob/master/tests/python/relay/test_dataflow_pattern.py + +Matching One of Two Ops +*** + +The first example is a simple case where we want to match one operator with a single input OR another operator with a single input, see the below diagram for a graphical representation and corresponding code: Review comment: @mbrookhart the diagrams are only available in the RFC but not in this document. Although we can upload the figures to web-data, I would prefer to keep the current version because I think the code itself is clear enough. Thus I removed this sentence. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] comaniac commented on a change in pull request #5676: [DOC] Improve Pattern Language Docs
comaniac commented on a change in pull request #5676: URL: https://github.com/apache/incubator-tvm/pull/5676#discussion_r431503106 ## File path: docs/langref/relay_pattern.rst ## @@ -139,3 +237,124 @@ Domination ** Match child pattern, find a match for the parent pattern, insuring that the child ultimately dominates the parrent (i.e., no nodes outside the pattern use outputs of the parent), and that ever node betwen the child and the pattern matches the path pattern. + +Applications + + +The pattern language provides not only the pattern matching but also pattern processing. +Here we introduce two pattern processing approaches and provide some examples. + +Pattern Rewriting +* + +If you would like to replace the matched pattern with another subgraph, you can leverage +the ``rewrite`` transformation. Here is an example of rewriting a series of arithmetic operators +with a single batch_norm op: + +.. code-block:: python + +class BatchnormCallback(DFPatternCallback): +# A callback class to rewrite the matched pattern to a batch_norm op. +def __init__(self): +self.x = wildcard() +self.var = wildcard() +self.mean = wildcard() +self.beta = wildcard() +self.gamma = wildcard() +self.eps = wildcard() + +self.pattern = self.gamma * (self.x - self.mean)/is_op("sqrt")(self.var + self.eps) + self.beta + +def callback(self, pre, post, node_map): +x = node_map[self.x][0] +var = node_map[self.var][0] +mean = node_map[self.mean][0] +beta = node_map[self.beta][0] +gamma = node_map[self.gamma][0] +eps = node_map[self.eps][0] +return relay.op.nn.batch_norm(x, gamma, beta, mean, var, epsilon = eps.data.asnumpy().item())[0] + +# A graph of arithmetic operators that are functional equivalent to batch_norm. +x = relay.var('x') +var = relay.var('var') +mean = relay.var('mean') +beta = relay.var('beta') +gamma = relay.var('gamma') +BN = gamma * (x - mean)/relay.op.sqrt(var + relay.const(1e-5)) + beta + +from tvm.relay.dataflow_pattern import rewrite +out = rewrite(BatchnormCallback(), BN) +assert tvm.ir.structural_equal(out, relay.op.nn.batch_norm(x, gamma, beta, mean, var, epsilon = 1e-5)[0]) + +The function ``def callback(self, pre, post, node_map)`` will be invoked when the rewriter matches +``self.pattern``. ``node_map`` is a dictionary mapping from pattern nodes to matched nodes in the graph. + +Pattern Partitioning + + +If you would like to perform a more complex processing for matched subgraphs and you are not +satisfy with ``rewrite``, you may consider partitioning the matched subgraphs to a separate Review comment: done 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] kevinthesun commented on a change in pull request #5684: [AutoTVM][TOPI] Fix bifrost spatial packing conv2d auto tune
kevinthesun commented on a change in pull request #5684: URL: https://github.com/apache/incubator-tvm/pull/5684#discussion_r431502771 ## File path: topi/python/topi/bifrost/conv2d.py ## @@ -142,13 +142,14 @@ def _schedule_spatial_pack(cfg, s, output, conv, data_vec, kernel_vec): s[data_vec].unroll(vw) if isinstance(kernel_vec.op, tvm.te.ComputeOp) and kernel_vec.name == 'kernel_vec': +co, ci, kh, kw, vc = s[kernel_vec].op.axis Review comment: Looks like this part share the logic with arm_cpu and mali. We can move this into [conv2d_nchw_spatial_pack compute](https://github.com/apache/incubator-tvm/blob/master/topi/python/topi/arm_cpu/conv2d_spatial_pack.py#L27). An example is in x86 conv2d: https://github.com/apache/incubator-tvm/blob/master/topi/python/topi/x86/conv2d.py#L188-L201 With this method, we can fix mali/arm_cpu/bifrost in one shot. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] masahi commented on a change in pull request #5676: [DOC] Improve Pattern Language Docs
masahi commented on a change in pull request #5676: URL: https://github.com/apache/incubator-tvm/pull/5676#discussion_r431481633 ## File path: docs/langref/relay_pattern.rst ## @@ -28,17 +28,34 @@ Such a language is not just useful for building a rewriter but also providing ex In the backend world, we could use the same machinery to build a higher level API using bring your own code generation. This API takes set of patterns describing your hardware capabilities and an external compiler, providing a relatively smooth heterogeneous experience out of the box. -Examples - +Pattern Examples + -There are quite a few properties that are worth matching of operators below we examine how to match tree properties, and expand on some use cases that are not fully explored in the prototype. The first example is a simple case where we want to match one operator with a single input OR another operator with a single input, see the below diagram for a graphical representation and corresponding code:: +There are quite a few properties of operators that are worth matching. Below we examine how to match tree properties, and expand on some use cases that are not fully explored in the prototype. This section +demonstrates how to write patterns. It is recommended to check `tests/python/relay/test_dataflow_pattern.py`_ +for more use cases. + +.. _tests/python/relay/test_dataflow_pattern.py: https://github.com/apache/incubator-tvm/blob/master/tests/python/relay/test_dataflow_pattern.py + +Matching One of Two Ops +*** + +The first example is a simple case where we want to match one operator with a single input OR another operator with a single input, see the below diagram for a graphical representation and corresponding code: Review comment: there is no diagram 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] masahi commented on a change in pull request #5676: [DOC] Improve Pattern Language Docs
masahi commented on a change in pull request #5676: URL: https://github.com/apache/incubator-tvm/pull/5676#discussion_r431481115 ## File path: docs/langref/relay_pattern.rst ## @@ -139,3 +237,124 @@ Domination ** Match child pattern, find a match for the parent pattern, insuring that the child ultimately dominates the parrent (i.e., no nodes outside the pattern use outputs of the parent), and that ever node betwen the child and the pattern matches the path pattern. + +Applications + + +The pattern language provides not only the pattern matching but also pattern processing. +Here we introduce two pattern processing approaches and provide some examples. + +Pattern Rewriting +* + +If you would like to replace the matched pattern with another subgraph, you can leverage +the ``rewrite`` transformation. Here is an example of rewriting a series of arithmetic operators +with a single batch_norm op: + +.. code-block:: python + +class BatchnormCallback(DFPatternCallback): +# A callback class to rewrite the matched pattern to a batch_norm op. +def __init__(self): +self.x = wildcard() +self.var = wildcard() +self.mean = wildcard() +self.beta = wildcard() +self.gamma = wildcard() +self.eps = wildcard() + +self.pattern = self.gamma * (self.x - self.mean)/is_op("sqrt")(self.var + self.eps) + self.beta + +def callback(self, pre, post, node_map): +x = node_map[self.x][0] +var = node_map[self.var][0] +mean = node_map[self.mean][0] +beta = node_map[self.beta][0] +gamma = node_map[self.gamma][0] +eps = node_map[self.eps][0] +return relay.op.nn.batch_norm(x, gamma, beta, mean, var, epsilon = eps.data.asnumpy().item())[0] + +# A graph of arithmetic operators that are functional equivalent to batch_norm. +x = relay.var('x') +var = relay.var('var') +mean = relay.var('mean') +beta = relay.var('beta') +gamma = relay.var('gamma') +BN = gamma * (x - mean)/relay.op.sqrt(var + relay.const(1e-5)) + beta + +from tvm.relay.dataflow_pattern import rewrite +out = rewrite(BatchnormCallback(), BN) +assert tvm.ir.structural_equal(out, relay.op.nn.batch_norm(x, gamma, beta, mean, var, epsilon = 1e-5)[0]) + +The function ``def callback(self, pre, post, node_map)`` will be invoked when the rewriter matches +``self.pattern``. ``node_map`` is a dictionary mapping from pattern nodes to matched nodes in the graph. + +Pattern Partitioning + + +If you would like to perform a more complex processing for matched subgraphs and you are not +satisfy with ``rewrite``, you may consider partitioning the matched subgraphs to a separate Review comment: satisfied 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[incubator-tvm] branch master updated: [Bugfix] Fix Python debugger segfaults with TVM built with LLVM (#5685)
This is an automated email from the ASF dual-hosted git repository. tqchen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git The following commit(s) were added to refs/heads/master by this push: new 291f4dc [Bugfix] Fix Python debugger segfaults with TVM built with LLVM (#5685) 291f4dc is described below commit 291f4dc8bb41a69805036b9d5eeb3ba3690d1812 Author: Junru Shao AuthorDate: Wed May 27 13:50:56 2020 -0700 [Bugfix] Fix Python debugger segfaults with TVM built with LLVM (#5685) * Import readline before loading libtvm * make lint happy --- python/tvm/_ffi/base.py | 5 + 1 file changed, 5 insertions(+) diff --git a/python/tvm/_ffi/base.py b/python/tvm/_ffi/base.py index 8674e31..2cca014 100644 --- a/python/tvm/_ffi/base.py +++ b/python/tvm/_ffi/base.py @@ -51,6 +51,11 @@ def _load_lib(): lib.TVMGetLastError.restype = ctypes.c_char_p return lib, os.path.basename(lib_path[0]) +try: +import readline # pylint: disable=unused-import +except ImportError: +pass + # version number __version__ = libinfo.__version__ # library instance
[GitHub] [incubator-tvm] tqchen merged pull request #5685: [Bugfix] Fix Python debugger segfaults with TVM built with LLVM
tqchen merged pull request #5685: URL: https://github.com/apache/incubator-tvm/pull/5685 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] junrushao1994 opened a new pull request #5685: [Bugfix] Fix Python debugger segfaults with TVM built with LLVM
junrushao1994 opened a new pull request #5685: URL: https://github.com/apache/incubator-tvm/pull/5685 This is a pretty long discussion [thread](https://discuss.tvm.ai/t/python-debugger-segfaults-with-tvm/843/9?u=junrushao1994). We are finally able to narrow down the root cause: when libtvm.so is linked against libLLVM.so, some versions (apt-get installed ones) of which are usually linked against libedit.so, the readline in pdb/ipdb conflicts with libedit. Two workarounds: 1) import readline before loading libtvm.so. (this PR) 2) built TVM with static LLVM, so that linkage unused in libLLVM.so are ignored. Some personal experience about installing pre-built LLVM: [clangdev](https://anaconda.org/conda-forge/clangdev/files) and [llvmdev](https://anaconda.org/conda-forge/llvmdev/files) from conda-forge works best with python, and have the most comprehensive pre-built binaries. ``` conda install -c conda-forge clangdev=$VERSION ``` CC: @jwfromm @icemelon9 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] siju-samuel commented on issue #5682: [TFLite] test_forward_mediapipe_hand_landmark() test fails due to non-supported 'DEQUANTIZE' operator in TFLite frontend
siju-samuel commented on issue #5682: URL: https://github.com/apache/incubator-tvm/issues/5682#issuecomment-634835461 #5394 will solve this problem 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] comaniac commented on a change in pull request #5676: [DOC] Improve Pattern Language Docs
comaniac commented on a change in pull request #5676: URL: https://github.com/apache/incubator-tvm/pull/5676#discussion_r431298138 ## File path: docs/langref/relay_pattern.rst ## @@ -139,3 +237,125 @@ Domination ** Match child pattern, find a match for the parent pattern, insuring that the child ultimately dominates the parrent (i.e., no nodes outside the pattern use outputs of the parent), and that ever node betwen the child and the pattern matches the path pattern. + +Applications + + +The pattern language provides not only the pattern matching but also pattern processing. The later Review comment: Make sence. Removed. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] comaniac commented on a change in pull request #5676: [DOC] Improve Pattern Language Docs
comaniac commented on a change in pull request #5676: URL: https://github.com/apache/incubator-tvm/pull/5676#discussion_r431297979 ## File path: docs/langref/relay_pattern.rst ## @@ -28,17 +28,34 @@ Such a language is not just useful for building a rewriter but also providing ex In the backend world, we could use the same machinery to build a higher level API using bring your own code generation. This API takes set of patterns describing your hardware capabilities and an external compiler, providing a relatively smooth heterogeneous experience out of the box. -Examples - +Pattern Examples + -There are quite a few properties that are worth matching of operators below we examine how to match tree properties, and expand on some use cases that are not fully explored in the prototype. The first example is a simple case where we want to match one operator with a single input OR another operator with a single input, see the below diagram for a graphical representation and corresponding code:: +There are quite a few properties that are worth matching of operators below we examine how to match tree properties, and expand on some use cases that are not fully explored in the prototype. This section Review comment: done 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] cchung100m opened a new pull request #5684: [AutoTVM][TOPI] Fix bifrost spatial packing conv2d auto tune
cchung100m opened a new pull request #5684: URL: https://github.com/apache/incubator-tvm/pull/5684 Hi @kevinthesun Following the issue #5215, I would appreciate that if you can help to review this PR, thank you. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] tqchen closed issue #5678: The method scale_shift_nchw in C should add shift from the values of channel
tqchen closed issue #5678: URL: https://github.com/apache/incubator-tvm/issues/5678 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[incubator-tvm] branch master updated: Fix the shift column for scale_shift_nchw and scale_shift_nhwc in C topi (#5679)
This is an automated email from the ASF dual-hosted git repository. tqchen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git The following commit(s) were added to refs/heads/master by this push: new e8bc77c Fix the shift column for scale_shift_nchw and scale_shift_nhwc in C topi (#5679) e8bc77c is described below commit e8bc77c0dcd9ed1508b1f9cce41bb3a7359d9fe1 Author: tobe AuthorDate: Wed May 27 23:59:02 2020 +0800 Fix the shift column for scale_shift_nchw and scale_shift_nhwc in C topi (#5679) --- topi/include/topi/nn/mapping.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/topi/include/topi/nn/mapping.h b/topi/include/topi/nn/mapping.h index d4a3a47..2bf3314 100644 --- a/topi/include/topi/nn/mapping.h +++ b/topi/include/topi/nn/mapping.h @@ -48,7 +48,7 @@ using namespace tvm::te; inline Tensor scale_shift_nchw(const Tensor& x, const Tensor& scale, const Tensor& shift, std::string name = "ScaleShift", std::string tag = kBroadcast) { return tvm::te::compute( - x->shape, [&](Var b, Var c, Var h, Var w) { return x(b, c, h, w) * scale(c) + shift(w); }, + x->shape, [&](Var b, Var c, Var h, Var w) { return x(b, c, h, w) * scale(c) + shift(c); }, name, tag); } @@ -66,7 +66,7 @@ inline Tensor scale_shift_nchw(const Tensor& x, const Tensor& scale, const Tenso inline Tensor scale_shift_nhwc(const Tensor& x, const Tensor& scale, const Tensor& shift, std::string name = "ScaleShift", std::string tag = kBroadcast) { return tvm::te::compute( - x->shape, [&](Var b, Var h, Var w, Var c) { return x(b, h, w, c) * scale(c) + shift(w); }, + x->shape, [&](Var b, Var h, Var w, Var c) { return x(b, h, w, c) * scale(c) + shift(c); }, name, tag); }
[GitHub] [incubator-tvm] tqchen merged pull request #5679: Fix the shift column for scale_shift_nchw and scale_shift_nhwc in C topi
tqchen merged pull request #5679: URL: https://github.com/apache/incubator-tvm/pull/5679 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] tqchen commented on pull request #5679: Fix the shift column for scale_shift_nchw and scale_shift_nhwc in C topi
tqchen commented on pull request #5679: URL: https://github.com/apache/incubator-tvm/pull/5679#issuecomment-634762789 THanks @tobegit3hub 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] tqchen commented on pull request #5681: [RELAY] Fix segfault in pretty print when ObjectRef is null
tqchen commented on pull request #5681: URL: https://github.com/apache/incubator-tvm/pull/5681#issuecomment-634761848 Thanks @lhutton1 . please add a regression testcase to cover the issue as per https://tvm.apache.org/docs/contribute/code_review.html#ensure-test-coverage 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] mbrookhart commented on a change in pull request #5676: [DOC] Improve Pattern Language Docs
mbrookhart commented on a change in pull request #5676: URL: https://github.com/apache/incubator-tvm/pull/5676#discussion_r431244615 ## File path: docs/langref/relay_pattern.rst ## @@ -28,17 +28,34 @@ Such a language is not just useful for building a rewriter but also providing ex In the backend world, we could use the same machinery to build a higher level API using bring your own code generation. This API takes set of patterns describing your hardware capabilities and an external compiler, providing a relatively smooth heterogeneous experience out of the box. -Examples - +Pattern Examples + -There are quite a few properties that are worth matching of operators below we examine how to match tree properties, and expand on some use cases that are not fully explored in the prototype. The first example is a simple case where we want to match one operator with a single input OR another operator with a single input, see the below diagram for a graphical representation and corresponding code:: +There are quite a few properties that are worth matching of operators below we examine how to match tree properties, and expand on some use cases that are not fully explored in the prototype. This section Review comment: "There are quite a few properties of operators that are worth matching. Below we examine..." ## File path: docs/langref/relay_pattern.rst ## @@ -139,3 +237,125 @@ Domination ** Match child pattern, find a match for the parent pattern, insuring that the child ultimately dominates the parrent (i.e., no nodes outside the pattern use outputs of the parent), and that ever node betwen the child and the pattern matches the path pattern. + +Applications + + +The pattern language provides not only the pattern matching but also pattern processing. The later Review comment: "The Pattern Language provides pattern processing in addition to matching capabilities. Here we introduce two pattern processing approaches and provide some examples." I don't think the middle sentence is necessary because you go into much greater detail below on the two approaches? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] mbrookhart commented on a change in pull request #5680: [Relay] Fix dataflow_pattern.rewrite() hang if Match in IR
mbrookhart commented on a change in pull request #5680: URL: https://github.com/apache/incubator-tvm/pull/5680#discussion_r431240142 ## File path: tests/python/relay/test_dataflow_pattern.py ## @@ -1033,6 +1033,18 @@ def conv_bias_relu(x, w, b): assert pattern2.match(relu) assert tvm.ir.structural_equal(func(x, w, b), pattern2.partition(relu)) +def test_match_match(): +add_pattern = is_op('add')(wildcard(), wildcard()) +class TestRewrite(DFPatternCallback): +def __init__(self): +self.pattern = add_pattern +def callback(self, pre, post, node_map): +return post.args[0] - post.args[1] +mod = tvm.IRModule({}) +tvm.relay.prelude.Prelude(mod) +# Apply rewrite on IR including relay.Match +rewrite(TestRewrite(), mod['tensor_concatenate_int64']) Review comment: Can you add an assert on the output of this? I understand the goal is to write something that will catch a rewrite overflow, but I'd prefer to check the output as well. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] siju-samuel opened a new pull request #5683: [PYTORCH]Minor bug fixes
siju-samuel opened a new pull request #5683: URL: https://github.com/apache/incubator-tvm/pull/5683 Bugfixes - arange -> start/stop/end may be already expr, so no need to create typedconst that time. - slice -> begin_dim may be an expr, so need to evaluate and find int and pass the value. - numtotensor -> input may be already an expr, no need to convert. - view -> if any value of new size is expr, need to evaluate and find the shape values. This can be simulated by running bert models. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] leandron opened a new issue #5682: [TFLite] test_forward_mediapipe_hand_landmark() test failes due to non-supported 'DEQUANTIZE' operator in TFLite frontend
leandron opened a new issue #5682: URL: https://github.com/apache/incubator-tvm/issues/5682 With the latest update to the `hand_landmark.tflite` network (publicly announced [here](https://twitter.com/googleai/status/1265319835283537921?s=21)), it is causing `test_forward_mediapipe_hand_landmark()` test to fail with `tvm.error.OpNotImplemented: The following operators are not supported in frontend TFLite: 'DEQUANTIZE'`. I guess we don't see it on CI because the old version of this file is probably cached on the machine. Running tests from scratch (without cached files) will make the issue reproduce. This is the error we see: ``` === FAILURES === _ test_forward_mediapipe_hand_landmark _ def test_forward_mediapipe_hand_landmark(): """Test MediaPipe 2D hand landmark TF Lite model.""" # MediaPipe 2D hand landmark TF tflite_model_file = download_testdata( "https://github.com/google/mediapipe/raw/master/mediapipe/models/hand_landmark.tflite";, "hand_landmark.tflite") with open(tflite_model_file, "rb") as f: tflite_model_buf = f.read() data = np.random.uniform(size=(1, 256, 256, 3)).astype('float32') tflite_output = run_tflite_graph(tflite_model_buf, data) > tvm_output = run_tvm_graph(tflite_model_buf, data, 'input_1', num_output=2) tests/python/frontend/tflite/test_forward.py:2220: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/python/frontend/tflite/test_forward.py:110: in run_tvm_graph dtype_dict=dtype_dict) python/tvm/relay/frontend/tflite.py:2606: in from_tflite op_converter.check_unsupported_ops() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def check_unsupported_ops(self): """Check unsupported TFLite ops in our converter.""" unsupported_ops_set = set() for op_idx in range(self.subgraph.OperatorsLength()): op = self.subgraph.Operators(op_idx) op_code_str = self.get_op_code_str(op) if op_code_str not in self.convert_map: unsupported_ops_set.add(op_code_str) if unsupported_ops_set: msg = 'The following operators are not supported in frontend ' \ 'TFLite: {}' ops = str(list(unsupported_ops_set)).strip('[,]') > raise tvm.error.OpNotImplemented(msg.format(ops)) E tvm.error.OpNotImplemented: The following operators are not supported in frontend TFLite: 'DEQUANTIZE' python/tvm/relay/frontend/tflite.py:165: OpNotImplemented - Captured stdout call - Downloading from url https://github.com/google/mediapipe/raw/master/mediapipe/models/hand_landmark.tflite to /workspace/.tvm_test_data/hand_landmark.tflite ``` 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] exitstop commented on issue #3905: Loader of opencl(module.loadbinary_opencl) is not presented
exitstop commented on issue #3905: URL: https://github.com/apache/incubator-tvm/issues/3905#issuecomment-634701594 Hey. Did you manage to solve this problem? `nullptr Loader of opencl(module.loadbinary_opencl) is not presented.` 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] lhutton1 opened a new pull request #5681: [RELAY] Fix segfault in pretty print when ObjectRef is null
lhutton1 opened a new pull request #5681: URL: https://github.com/apache/incubator-tvm/pull/5681 Encountered when pretty printing module with function attribute equal to NullValue(). 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] lixiaoquan removed a comment on pull request #5656: [BYOC] Pattern Language MergeComposite
lixiaoquan removed a comment on pull request #5656: URL: https://github.com/apache/incubator-tvm/pull/5656#issuecomment-634447632 > @lixiaoquan fixed in that PR, but I didn't add your test because because I'm not sure we're ready for that change to the TF test. Thoughts? Thanks a lot to fix it so quickly! I found another issue, if applying *rewrite()* on a function in Prelude, it will hang. It is ok to apply *partition()* on it. I use test_control_flow.py just because it will generate prelude functions in IRModule ``` diff --git a/tests/python/frontend/tensorflow/test_control_flow.py b/tests/python/frontend/tensorflow/test_control_flow.py index 90035279b..a803c8264 100644 --- a/tests/python/frontend/tensorflow/test_control_flow.py +++ b/tests/python/frontend/tensorflow/test_control_flow.py @@ -26,10 +26,24 @@ import numpy as np from tvm import nd from tvm import relay from tvm.relay.frontend.tensorflow import from_tensorflow +from tvm.relay.dataflow_pattern import * +add_pattern = is_op('add')(wildcard(), wildcard()) +sub_pattern = is_op('subtract')(wildcard(), wildcard()) +class TestRewrite(DFPatternCallback): +def __init__(self): +self.pattern = add_pattern +def callback(self, pre, post, node_map): +return post.args[0] - post.args[1] + def check_equal(graph, tf_out, input_map=None): mod, params = from_tensorflow(graph.as_graph_def(add_shapes=True)) + +print(mod['tensor_concatenate_int64']) + +rewrite(TestRewrite(), mod['tensor_concatenate_int64'].body) + if input_map is not None: params.update(input_map) ex = relay.create_executor('vm', mod=mod) ``` 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] lixiaoquan opened a new pull request #5680: [Relay] Fix dataflow_pattern.rewrite() hang if Match in IR
lixiaoquan opened a new pull request #5680: URL: https://github.com/apache/incubator-tvm/pull/5680 rewrite() quits only if graph stop changing, but ExprMutator always creates new Match node. This patch fixes this. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org