heliqi commented on code in PR #14172:
URL: https://github.com/apache/tvm/pull/14172#discussion_r1133423472
##########
python/tvm/relay/frontend/paddlepaddle.py:
##########
@@ -475,6 +499,39 @@ def convert_elementwise_op(g, op, block):
g.add_node(op.output("Out")[0], out)
+def convert_linspace(g, op, block):
+ """Operator converter for linspace."""
+
+ start = g.get_node(op.input("Start")[0])
+ stop = g.get_node(op.input("Stop")[0])
+ num = g.get_node(op.input("Num")[0])
+ dtype = _convert_dtype_value(op.attr("dtype"))
+
+ start = _op.cast(start, dtype)
+ stop = _op.cast(stop, dtype)
+ num = _op.cast(num, dtype)
+
+ if dtype in ["int32", "float32"]:
+ tmp_dtype = "float32"
+ else:
+ tmp_dtype = "float64"
+ start = _op.cast(start, tmp_dtype)
Review Comment:
There should be static and dynamic shape cases.
If it is a static shape, the op to TVM is very small;
If the value cannot be inferred from the dynamic shape, more op will be
converted to TVM, which may affect performance.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]