aboutsummaryrefslogtreecommitdiff
path: root/reference_model/src/ops/ewise_binary.cc
diff options
context:
space:
mode:
Diffstat (limited to 'reference_model/src/ops/ewise_binary.cc')
-rw-r--r--reference_model/src/ops/ewise_binary.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/reference_model/src/ops/ewise_binary.cc b/reference_model/src/ops/ewise_binary.cc
index a11d855..023158c 100644
--- a/reference_model/src/ops/ewise_binary.cc
+++ b/reference_model/src/ops/ewise_binary.cc
@@ -60,23 +60,24 @@ int BinaryNodeBase<Rank, InDtype, OutDtype>::checkTensorAttributes()
return 1;
}
- // Input and output rank must match
- // If it's not MUL, type also needs to match as well.
- if (nodeType != Op_MUL)
+ // In some ops, only rank of input and output tensor needs to match
+ if (nodeType == Op_MUL || nodeType == Op_GREATER || nodeType == Op_EQUAL || nodeType == Op_GREATER_EQUAL)
{
- if (inputs[0]->matchRankType(*outputs[0]))
+ if (inputs[0]->matchRank(*outputs[0]))
{
- printNodeValidationError("Binary operators (except MUL) input and output rank and type must match");
+ std::string err =
+ "Binary operators " + std::string(EnumNamesOp()[nodeType]) + " input and output rank must match";
+ printNodeValidationError(err.c_str());
return 1;
}
}
- else
+ // Otherwise both rand/type of input and output must match
+ else if (inputs[0]->matchRankType(*outputs[0]))
{
- if (inputs[0]->matchRank(*outputs[0]))
- {
- printNodeValidationError("MUL operator input and output rank must match");
- return 1;
- }
+ std::string err =
+ "Binary operators " + std::string(EnumNamesOp()[nodeType]) + " input and output rank and type must match";
+ printNodeValidationError(err.c_str());
+ return 1;
}
a = dynamic_cast<TosaReference::TensorTemplate<TIn>*>(inputs[0]);