aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Cheng <kevin.cheng@arm.com>2021-09-28 15:48:27 -0700
committerKevin Cheng <kevin.cheng@arm.com>2021-09-28 15:48:27 -0700
commit269e898e23cfb4acb337beb5385620ac5afd9df8 (patch)
treebdf4939230de4982d4630b16b94365f928278290
parentc42addcee5240d9a0846d3f7e8cb5f88c80e2975 (diff)
downloadreference_model-269e898e23cfb4acb337beb5385620ac5afd9df8.tar.gz
Remove ReluN op.
Signed-off-by: Kevin Cheng <kevin.cheng@arm.com> Change-Id: Iaac727159a84de1f83de549c3a22704096f46bf9
-rw-r--r--reference_model/src/ops/activation_funcs.cc28
-rw-r--r--reference_model/src/ops/activation_funcs.h20
-rw-r--r--reference_model/src/ops/op_factory.cc4
-rw-r--r--verif/tosa_test_gen.py19
4 files changed, 0 insertions, 71 deletions
diff --git a/reference_model/src/ops/activation_funcs.cc b/reference_model/src/ops/activation_funcs.cc
index 440f4e1..21677d5 100644
--- a/reference_model/src/ops/activation_funcs.cc
+++ b/reference_model/src/ops/activation_funcs.cc
@@ -51,31 +51,6 @@ int OpClamp<Rank, Dtype>::register_fcn()
}
template <int Rank, DType Dtype>
-int OpReluN<Rank, Dtype>::register_fcn()
-{
-
- switch (Dtype)
- {
- case DType_FLOAT:
- {
- InEigenType N = (InEigenType)attribute->max_fp();
- this->fcn = [N](InEigenType a) -> OutEigenType { return a >= 0 ? (a <= N ? a : N) : 0; };
- }
- break;
- case DType_INT32:
- {
- InEigenType N = (InEigenType)attribute->max_int();
- this->fcn = [N](InEigenType a) -> OutEigenType { return a >= 0 ? (a <= N ? a : N) : 0; };
- }
- break;
- default:
- ERROR_IF(true, "unsupported DType %s", EnumNamesDType()[Dtype]);
- }
-
- return 0;
-}
-
-template <int Rank, DType Dtype>
int OpSigmoid<Rank, Dtype>::register_fcn()
{
switch (Dtype)
@@ -110,9 +85,6 @@ DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpClamp, FLOAT);
DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpClamp, INT8);
DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpClamp, INT16);
-DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpReluN, FLOAT);
-DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpReluN, INT32);
-
DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpSigmoid, FLOAT);
DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpTanh, FLOAT);
diff --git a/reference_model/src/ops/activation_funcs.h b/reference_model/src/ops/activation_funcs.h
index c834b52..10385e0 100644
--- a/reference_model/src/ops/activation_funcs.h
+++ b/reference_model/src/ops/activation_funcs.h
@@ -45,26 +45,6 @@ protected:
};
template <int Rank, DType Dtype>
-class OpReluN : public UnaryNode<Rank, Dtype>
-{
-public:
- OpReluN(SubgraphTraverser* sgt_, TosaAttributeBase* attribute_, TosaQuantInfoBase* qinfo_, uint64_t id_)
- : UnaryNode<Rank, Dtype>(sgt_, Op_RELUN, id_)
- {
- INIT_ATTRIBUTE(ReluN);
- register_fcn();
- }
- static constexpr int32_t QMin = GetQMin<Dtype>::value;
- static constexpr int32_t QMax = GetQMax<Dtype>::value;
- using InEigenType = typename GetEigenType<Dtype>::type;
- using OutEigenType = typename GetEigenType<Dtype>::type;
- virtual int register_fcn();
-
-protected:
- TosaReluNAttribute* attribute;
-};
-
-template <int Rank, DType Dtype>
class OpSigmoid : public UnaryNode<Rank, Dtype>
{
public:
diff --git a/reference_model/src/ops/op_factory.cc b/reference_model/src/ops/op_factory.cc
index 3bc55a8..a9ee136 100644
--- a/reference_model/src/ops/op_factory.cc
+++ b/reference_model/src/ops/op_factory.cc
@@ -105,10 +105,6 @@ GraphNode* OpFactory::newOp(SubgraphTraverser* sgt,
DEF_FACTORY_RANK0_6_ONE_RANK_ONE_TYPE(OpClamp, INT8);
DEF_FACTORY_RANK0_6_ONE_RANK_ONE_TYPE(OpClamp, INT16);
break;
- case Op_RELUN:
- DEF_FACTORY_RANK0_6_ONE_RANK_ONE_TYPE(OpReluN, FLOAT);
- DEF_FACTORY_RANK0_6_ONE_RANK_ONE_TYPE(OpReluN, INT32);
- break;
case Op_SIGMOID:
DEF_FACTORY_RANK0_6_ONE_RANK_ONE_TYPE(OpSigmoid, FLOAT);
break;
diff --git a/verif/tosa_test_gen.py b/verif/tosa_test_gen.py
index f55d892..4aa42da 100644
--- a/verif/tosa_test_gen.py
+++ b/verif/tosa_test_gen.py
@@ -1842,19 +1842,6 @@ class TosaTestGen:
self.ser.addOperator(op, [a.name], [result_tens.name])
return result_tens
- def build_relun(self, op, a):
- result_tens = OutputShaper.unaryOp(self.ser, a)
-
- attr = ts.TosaSerializerAttribute()
-
- if a.dtype == DType.FLOAT:
- attr.ReluNAttribute(0, self.getRandNumberDType(a.dtype))
- else:
- attr.ReluNAttribute(self.getRandNumberDType(a.dtype), 0)
-
- self.ser.addOperator(op, [a.name], [result_tens.name], attr)
- return result_tens
-
def build_sigmoid(self, op, a):
result_tens = OutputShaper.unaryOp(self.ser, a)
self.ser.addOperator(op, [a.name], [result_tens.name])
@@ -2909,12 +2896,6 @@ class TosaTestGen:
"build_fcn": (build_clamp, TosaTensorGen.tgBasic, None),
"types": TYPE_NARROW_INT_FP,
},
- "relun": {
- "op": Op.RELUN,
- "operands": (1, 0),
- "build_fcn": (build_relun, TosaTensorGen.tgBasic, None),
- "types": TYPE_FI32,
- },
"sigmoid": {
"op": Op.SIGMOID,
"operands": (1, 0),