diff options
author | Jerry Ge <jerry.ge@arm.com> | 2023-07-19 23:08:16 +0000 |
---|---|---|
committer | Jerry Ge <jerry.ge@arm.com> | 2023-07-25 22:49:17 +0000 |
commit | 9c9c8dafe8f9a32bd70aee268cd537b93865a3ba (patch) | |
tree | e94fc471261b9f72bef86033fbc76022f55d5de8 /reference_model/src/ops/ewise_ternary.cc | |
parent | c1e13432b4a218781afd6b0171d4afff11730433 (diff) | |
download | reference_model-9c9c8dafe8f9a32bd70aee268cd537b93865a3ba.tar.gz |
Run clang-format and update copyright
- Also added run clang-format to pre-commit runs
Signed-off-by: Jerry Ge <jerry.ge@arm.com>
Change-Id: I4e59ac0afbaa30dce0773aa63d92a1a3b119e2f3
Diffstat (limited to 'reference_model/src/ops/ewise_ternary.cc')
-rw-r--r-- | reference_model/src/ops/ewise_ternary.cc | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/reference_model/src/ops/ewise_ternary.cc b/reference_model/src/ops/ewise_ternary.cc index fd2510f..5861cb2 100644 --- a/reference_model/src/ops/ewise_ternary.cc +++ b/reference_model/src/ops/ewise_ternary.cc @@ -20,9 +20,7 @@ using namespace Eigen; using namespace tosa; template <int Rank, TOSA_REF_TYPE Dtype> -OpSelectBase<Rank, Dtype>::OpSelectBase(SubgraphTraverser* sgt_, - TosaAttributeBase* attribute_, - uint64_t id_) +OpSelectBase<Rank, Dtype>::OpSelectBase(SubgraphTraverser* sgt_, TosaAttributeBase* attribute_, uint64_t id_) : GraphNode(sgt_, Op_SELECT, id_) { setRequiredOperands(3, 1); @@ -83,17 +81,26 @@ int OpSelect<Rank, Dtype>::broadcast(std::vector<int>& calculated_shape) // calculates the broadcasted output shape calculated_shape = cond_shape; - for (size_t i = 0; i < calculated_shape.size(); i++) { - if (calculated_shape[i] == 1) { + for (size_t i = 0; i < calculated_shape.size(); i++) + { + if (calculated_shape[i] == 1) + { calculated_shape[i] = then_shape[i]; - } else { - ERROR_IF(then_shape[i] != 1 && then_shape[i] != calculated_shape[i], "Broadcast_shape failure, input shapes are not compatible"); + } + else + { + ERROR_IF(then_shape[i] != 1 && then_shape[i] != calculated_shape[i], + "Broadcast_shape failure, input shapes are not compatible"); } - if (calculated_shape[i] == 1) { + if (calculated_shape[i] == 1) + { calculated_shape[i] = else_shape[i]; - } else { - ERROR_IF(else_shape[i] != 1 && else_shape[i] != calculated_shape[i], "Broadcast_shape failure, input shapes are not compatible"); + } + else + { + ERROR_IF(else_shape[i] != 1 && else_shape[i] != calculated_shape[i], + "Broadcast_shape failure, input shapes are not compatible"); } } @@ -107,7 +114,8 @@ int OpSelect<Rank, Dtype>::eval() this->broadcast(calculated_shape); auto result_shape = this->out->getShape(); - ERROR_IF(calculated_shape != result_shape, "Broadcast_shape failure, calculated_shape and result_shape don't match"); + ERROR_IF(calculated_shape != result_shape, + "Broadcast_shape failure, calculated_shape and result_shape don't match"); this->out->getTensor() = this->cond->getTensor() .broadcast(this->bcast_cond) |