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


##########
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:
   Proposed implementation keeps the status quo. There is an implicit 
restriction that ifm and ofm dtypes match. In this PR we just make it explicit. 
I suggest addressing this in further PRs by allowing ifm and ofm dtypes not 
match in specific cases of pooling operations.



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