Aleksei-grovety commented on code in PR #14353:
URL: https://github.com/apache/tvm/pull/14353#discussion_r1163017424


##########
src/relay/op/contrib/ethosu/pooling.cc:
##########
@@ -61,15 +61,27 @@ bool EthosuPoolingRel(const Array<Type>& types, int 
num_inputs, const Attrs& att
                                                             DataType::Int(16), 
DataType::Int(32)};
 
   std::initializer_list<DataType>& allowed_ifm_dtypes = 
max_avg_pooling_ifm_dtypes;
-  auto ofm_dtype = ifm->dtype;
   if (param->pooling_type == "SUM") {
     allowed_ifm_dtypes = sum_pooling_ifm_dtypes;
-    ofm_dtype = DataType::Int(32);
   }
 
   CheckDataType(reporter, ifm->dtype, allowed_ifm_dtypes, operator_name, "ifm",
                 param->pooling_type);
 
+  DataType ofm_dtype = DataTypeFromString(param->ofm_dtype);
+
+  std::initializer_list<DataType> max_avg_pooling_ofm_dtypes = 
{DataType::Int(8), DataType::UInt(8),
+                                                                
DataType::Int(16)};
+  if (param->pooling_type == "AVG" || param->pooling_type == "MAX") {
+    CheckDataType(reporter, ofm_dtype, max_avg_pooling_ofm_dtypes, 
operator_name, "ofm",
+                  param->pooling_type);
+    CheckDataTypeMatch(reporter, ofm_dtype, ifm->dtype, operator_name, "ifm", 
"ofm",

Review Comment:
   According to 
[TRM](https://developer.arm.com/documentation/102420/0200/Programmers-model/Operators-and-performance/Operations),
 input and output data types must match for average pool with padding or max 
pool.



-- 
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]

Reply via email to