return result;
}
+bool checkDataTypeInputandOutput(const Layer& layer)
+{
+ auto inputInfo = layer.GetInputSlot(0).GetConnection()->GetTensorInfo();
+ auto outputInfo = layer.GetOutputSlot(0).GetTensorInfo();
+ bool sameDataType = (inputInfo.GetDataType() == outputInfo.GetDataType());
+
+ // Check is same quantization info (same scale and offset)
+ if (sameDataType)
+ {
+ if (IsQuantizedType(inputInfo.GetDataType()))
+ {
+ bool sameScale = (inputInfo.GetQuantizationScale() == outputInfo.GetQuantizationScale());
+ bool sameOffset = (inputInfo.GetQuantizationOffset() == outputInfo.GetQuantizationOffset());
+
+ return (sameScale && sameOffset);
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+}
+
} // namespace
inline void ReportUntouchedLayers(OptimizationViews& optimizationViews, std::map<LayerGuid, Layer*> untouched)
{
for (auto&& childInput : output->GetConnections())
{
- if (childInput->GetOwningLayer().GetType() == LayerType::Activation)
+ if ((childInput->GetOwningLayer().GetType() == LayerType::Activation) &&
+ (checkDataTypeInputandOutput(childInput->GetOwningLayer())))
{
Layer& child = childInput->GetOwningLayer();
{
for (auto&& childInput : output->GetConnections())
{
- if (childInput->GetOwningLayer().GetType() == LayerType::Activation)
+ if ((childInput->GetOwningLayer().GetType() == LayerType::Activation) &&
+ (checkDataTypeInputandOutput(childInput->GetOwningLayer())))
{
Layer& child = childInput->GetOwningLayer();