Add Transpose into fusible list.

This commit is contained in:
dayschan 2020-11-10 15:38:04 +08:00
parent d70f25edc0
commit 195b1fe8d5
4 changed files with 11 additions and 6 deletions

2
akg

@ -1 +1 @@
Subproject commit 2956e64803cad9b84316cdf2b25d034c5f944ccc
Subproject commit 1866f35fe0d1f10acfc1da0a69e9cb44cf37bb4c

View File

@ -30,6 +30,8 @@ class GraphSplitByPattern:
self.in_relations = dict() # {area1: relation1, area2: relation2, ...}
self.out_relations = dict() # {area1: relation1, area2: relation2, ...}
self.mode = self.MODE_BASIC
if self.pattern == PrimLib.TRANSFORM:
self.mode = self.MODE_COMPOSITE
def __str__(self):
return '<' + '-'.join([op.output.name for op in self.ops]) + '>'

View File

@ -157,6 +157,8 @@ class PrimLib:
'ExpandDims': Prim(ELEMWISE),
'InplaceAssign': Prim(ELEMWISE),
'@ReduceInit': Prim(ELEMWISE),
'Reshape': Prim(ELEMWISE),
'Transpose': Prim(TRANSFORM),
}
default_primtive = Prim(UNKNOWN)

View File

@ -726,11 +726,12 @@ std::string ExtractGraphKernelName(const AnfNodePtrList &cnodes, const string &p
std::vector<PrimitivePtr> GetFusibleOpList() {
std::vector<PrimitivePtr> fusible_basic_ops = {
prim::kPrimAbs, prim::kPrimRound, prim::kPrimNeg, prim::kPrimExp, prim::kPrimTensorAdd,
prim::kPrimRealDiv, prim::kPrimMul, prim::kPrimMinimum, prim::kPrimMaximum, prim::kPrimLog,
prim::kPrimPow, prim::kPrimSub, prim::kPrimRsqrt, prim::kPrimSqrt, prim::kPrimCast,
prim::kPrimAddN, prim::kPrimEqual, prim::kPrimReciprocal, prim::KPrimTransData, prim::kPrimSelect,
prim::kPrimGreater, prim::kPrimAssign, prim::kPrimReduceSum, prim::kPrimTanh, prim::kPrimReshape};
prim::kPrimAbs, prim::kPrimRound, prim::kPrimNeg, prim::kPrimExp, prim::kPrimTensorAdd,
prim::kPrimRealDiv, prim::kPrimMul, prim::kPrimMinimum, prim::kPrimMaximum, prim::kPrimLog,
prim::kPrimPow, prim::kPrimSub, prim::kPrimRsqrt, prim::kPrimSqrt, prim::kPrimCast,
prim::kPrimAddN, prim::kPrimEqual, prim::kPrimReciprocal, prim::KPrimTransData, prim::kPrimSelect,
prim::kPrimGreater, prim::kPrimAssign, prim::kPrimReduceSum, prim::kPrimTanh, prim::kPrimReshape,
prim::kPrimTranspose};
return fusible_basic_ops;
}