aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/operation.py
diff options
context:
space:
mode:
authorDiqing Zhong <diqing.zhong@arm.com>2021-01-26 12:12:51 +0100
committerDiqing Zhong <diqing.zhong@arm.com>2021-01-29 16:17:40 +0100
commit189f748e1a79ed88044efbe7137963bca830cbb5 (patch)
tree4d3db8614574b5aedcf952941c2194e2bf7f8285 /ethosu/vela/operation.py
parent2c2522dd44229a03d3d778cd239478fedc19ee57 (diff)
downloadethos-u-vela-189f748e1a79ed88044efbe7137963bca830cbb5.tar.gz
MLBEDSW-3224: Support HardSwish
Change-Id: If49abc31f093f1bd3393bee86f821fd35972086f Signed-off-by: Diqing Zhong <diqing.zhong@arm.com>
Diffstat (limited to 'ethosu/vela/operation.py')
-rw-r--r--ethosu/vela/operation.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/ethosu/vela/operation.py b/ethosu/vela/operation.py
index 8d54d658..73953cec 100644
--- a/ethosu/vela/operation.py
+++ b/ethosu/vela/operation.py
@@ -165,7 +165,7 @@ class Op(Enum):
GatherV2 = OperatorInfo()
Greater = OperatorInfo()
GreaterEqual = OperatorInfo()
- HardSwish = OperatorInfo()
+ HardSwish = OperatorInfo(indices=IFM_INDICES)
HashtableLookup = OperatorInfo()
Identity = OperatorInfo()
If = OperatorInfo()
@@ -305,7 +305,7 @@ class Op(Enum):
return self in (Op.Relu, Op.Relu6, Op.ReluN1To1, Op.Clip)
def is_activation_op(self):
- return self.is_relu_op() or self in (Op.Tanh, Op.Sigmoid, Op.Softmax, Op.LUT)
+ return self.is_relu_op() or self in (Op.Tanh, Op.Sigmoid, Op.Softmax, Op.LUT, Op.HardSwish)
def is_split_op(self):
return self in (Op.Split, Op.SplitV, Op.StridedSlice, Op.Slice, Op.UnpackReshaped, Op.Unpack)
@@ -372,6 +372,8 @@ def create_activation_function(op_type: Op) -> ActivationFunction:
elif op_type == Op.Sigmoid:
act.min = 0.0
act.max = 1.0
+ elif op_type == Op.HardSwish:
+ act.min = 0.0
return act