jackwish commented on a change in pull request #4611: {QNN] Making
scale/zero_points as expr instead of attrs.
URL: https://github.com/apache/incubator-tvm/pull/4611#discussion_r362707098
##########
File path: src/relay/qnn/op/concatenate.cc
##########
@@ -34,19 +34,48 @@ namespace tvm {
namespace relay {
namespace qnn {
-TVM_REGISTER_NODE_TYPE(QnnConcatenateAttrs);
-
-Expr MakeQnnConcatenate(Expr data, Array<tvm::Expr> input_scales,
- Array<tvm::Expr> input_zero_points, double
output_scale,
- int32_t output_zero_point, int axis) {
- auto attrs = make_object<QnnConcatenateAttrs>();
- attrs->input_scales = std::move(input_scales);
- attrs->input_zero_points = std::move(input_zero_points);
- attrs->output_scale = output_scale;
- attrs->output_zero_point = output_zero_point;
+bool QnnConcatenateRel(const Array<Type>& types, int num_inputs, const Attrs&
attrs,
+ const TypeReporter& reporter) {
+ CHECK_EQ(types.size(), 6);
+
+ // Check the scale and zero point types
+ const auto* input_scales_tuple = types[1].as<TupleTypeNode>();
+ if (input_scales_tuple == nullptr) {
+ throw relay::Error(
+ RELAY_ERROR("qnn concatenate requires a tuple of scales as the second
argument, found "
+ << PrettyPrint(types[1])));
+ }
+ for (auto input_scale : input_scales_tuple->fields) {
+ CHECK(IsScalarType(input_scale, DataType::Float(32))); //
input_scales[idx]
+ }
+
+ const auto* input_zero_points_tuple = types[2].as<TupleTypeNode>();
+ if (input_zero_points_tuple == nullptr) {
+ throw relay::Error(
+ RELAY_ERROR("qnn concatenate requires a tuple of zero_points as the
third argument, found "
+ << PrettyPrint(types[2])));
+ }
+ for (auto input_zero_point : input_zero_points_tuple->fields) {
Review comment:
could be `auto&`?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services