| 1038 | } |
| 1039 | |
| 1040 | bool RefLayerSupport::IsConvolution2dSupported(const TensorInfo& input, |
| 1041 | const TensorInfo& output, |
| 1042 | const Convolution2dDescriptor& descriptor, |
| 1043 | const TensorInfo& weights, |
| 1044 | const Optional<TensorInfo>& biases, |
| 1045 | Optional<std::string&> reasonIfUnsupported) const |
| 1046 | { |
| 1047 | bool supported = true; |
| 1048 | |
| 1049 | // Define supported types. |
| 1050 | std::array<DataType,7> supportedTypes = |
| 1051 | { |
| 1052 | DataType::Float32, |
| 1053 | DataType::Float16, |
| 1054 | DataType::QAsymmS8, |
| 1055 | DataType::QAsymmU8, |
| 1056 | DataType::QSymmS8, |
| 1057 | DataType::QSymmS16 |
| 1058 | }; |
| 1059 | |
| 1060 | supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported, |
| 1061 | "Reference Convolution2d: input is not a supported type."); |
| 1062 | |
| 1063 | supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, |
| 1064 | "Reference Convolution2d: output is not a supported type."); |
| 1065 | |
| 1066 | supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, |
| 1067 | "Reference Convolution2d: input and output types mismatched."); |
| 1068 | |
| 1069 | |
| 1070 | const DataType inputType = input.GetDataType(); |
| 1071 | if (IsQuantized8BitType(inputType)) |
| 1072 | { |
| 1073 | std::array<DataType, 3> supportedWeightTypes = |
| 1074 | { |
| 1075 | DataType::QAsymmS8, |
| 1076 | DataType::QAsymmU8, |
| 1077 | DataType::QSymmS8 |
| 1078 | }; |
| 1079 | |
| 1080 | supported &= CheckSupportRule(TypeAnyOf(weights, supportedWeightTypes), reasonIfUnsupported, |
| 1081 | "Reference Convolution2d: weights type not supported for quantized input."); |
| 1082 | } |
| 1083 | else |
| 1084 | { |
| 1085 | supported &= CheckSupportRule(TypeAnyOf(weights, supportedTypes), reasonIfUnsupported, |
| 1086 | "Reference Convolution2d: weights is not a supported type."); |
| 1087 | |
| 1088 | supported &= CheckSupportRule(TypesAreEqual(input, weights), reasonIfUnsupported, |
| 1089 | "Reference Convolution2d: input and weights types mismatched."); |
| 1090 | } |
| 1091 | |
| 1092 | if (biases.has_value()) |
| 1093 | { |
| 1094 | std::array<DataType,4> biasesSupportedTypes = |
| 1095 | { |
| 1096 | DataType::Float32, |
| 1097 | DataType::Float16, |
nothing calls this directly
no test coverage detected