Skip to content
Snippets Groups Projects
Commit 3689a4e1 authored by Pratik Bhatu's avatar Pratik Bhatu
Browse files

Add addv2, fusedbatchnormv3, softmax(identity)

parent 051c6a41
No related branches found
No related tags found
No related merge requests found
...@@ -116,6 +116,13 @@ class TFNodesAST: ...@@ -116,6 +116,13 @@ class TFNodesAST:
TFNodesAST.getOperatorsIdx('+'), TFNodesAST.getOperatorsIdx('+'),
AST.ID(dictNodeNameToOutVarStr[inputsRef[1]]) AST.ID(dictNodeNameToOutVarStr[inputsRef[1]])
)) ))
def AddV2(graph : Graph.Graph, curNode : Graph.Node, dictNodeNameToOutVarStr : dict, extraNodeInfoDict : dict):
inputsRef = curNode.getInputsRef()
assert(len(inputsRef) == 2)
return (None, AST.BOp(AST.ID(dictNodeNameToOutVarStr[inputsRef[0]]),
TFNodesAST.getOperatorsIdx('+'),
AST.ID(dictNodeNameToOutVarStr[inputsRef[1]])
))
def Mul(graph : Graph.Graph, curNode : Graph.Node, dictNodeNameToOutVarStr : dict, extraNodeInfoDict : dict): def Mul(graph : Graph.Graph, curNode : Graph.Node, dictNodeNameToOutVarStr : dict, extraNodeInfoDict : dict):
inputsRef = curNode.getInputsRef() inputsRef = curNode.getInputsRef()
...@@ -533,6 +540,12 @@ class TFNodesAST: ...@@ -533,6 +540,12 @@ class TFNodesAST:
AST.ID(dictNodeNameToOutVarStr[inputsRef[1]]), AST.ID(dictNodeNameToOutVarStr[inputsRef[1]]),
AST.ID(dictNodeNameToOutVarStr[inputsRef[2]]), AST.ID(dictNodeNameToOutVarStr[inputsRef[2]]),
)) ))
def FusedBatchNormV3(graph : Graph.Graph, curNode : Graph.Node, dictNodeNameToOutVarStr : dict, extraNodeInfoDict : dict):
inputsRef = curNode.getInputsRef()
return (None, AST.FusedBatchNorm(AST.ID(dictNodeNameToOutVarStr[inputsRef[0]]),
AST.ID(dictNodeNameToOutVarStr[inputsRef[1]]),
AST.ID(dictNodeNameToOutVarStr[inputsRef[2]]),
))
def Squeeze(graph : Graph.Graph, curNode : Graph.Node, dictNodeNameToOutVarStr : dict, extraNodeInfoDict : dict): def Squeeze(graph : Graph.Graph, curNode : Graph.Node, dictNodeNameToOutVarStr : dict, extraNodeInfoDict : dict):
# TODO : Do this in somewhat better way # TODO : Do this in somewhat better way
...@@ -563,6 +576,9 @@ class TFNodesAST: ...@@ -563,6 +576,9 @@ class TFNodesAST:
inputsRef = curNode.getInputsRef() inputsRef = curNode.getInputsRef()
return (None, AST.ID(dictNodeNameToOutVarStr[inputsRef[0]])) return (None, AST.ID(dictNodeNameToOutVarStr[inputsRef[0]]))
def Softmax(graph : Graph.Graph, curNode : Graph.Node, dictNodeNameToOutVarStr : dict, extraNodeInfoDict : dict):
inputsRef = curNode.getInputsRef()
return (None, AST.ID(dictNodeNameToOutVarStr[inputsRef[0]]))
# def StridedSlice(graph : Graph.Graph, curNode : Graph.Node, dictNodeNameToOutVarStr : dict, extraNodeInfoDict : dict): # def StridedSlice(graph : Graph.Graph, curNode : Graph.Node, dictNodeNameToOutVarStr : dict, extraNodeInfoDict : dict):
# inputsRef = curNode.getInputsRef() # inputsRef = curNode.getInputsRef()
# return (None, AST.ID(dictNodeNameToOutVarStr[inputsRef[0]])) # return (None, AST.ID(dictNodeNameToOutVarStr[inputsRef[0]]))
...@@ -575,4 +591,4 @@ class TFNodesAST: ...@@ -575,4 +591,4 @@ class TFNodesAST:
# retAST = AST.UninterpFuncCall(extraNodeInfoDict[curNode.getName()][0], # retAST = AST.UninterpFuncCall(extraNodeInfoDict[curNode.getName()][0],
# TFNodesAST.UninterpFuncCallNames.Pack.name, # TFNodesAST.UninterpFuncCallNames.Pack.name,
# list(map(lambda x : AST.ID(dictNodeNameToOutVarStr[x]), inputsRef)) + [AST.Int(axis)] ) # list(map(lambda x : AST.ID(dictNodeNameToOutVarStr[x]), inputsRef)) + [AST.Int(axis)] )
# return (None, retAST) # return (None, retAST)
\ No newline at end of file
...@@ -278,7 +278,7 @@ def void FusedBatchNorm4411(int32_pl s1, int32_pl s2, int32_pl s3, int32_pl s4, ...@@ -278,7 +278,7 @@ def void FusedBatchNorm4411(int32_pl s1, int32_pl s2, int32_pl s3, int32_pl s4,
def void ReduceMean24(int32_pl outS1, int32_pl outS2, def void ReduceMean24(int32_pl outS1, int32_pl outS2,
int32_pl inS1, int32_pl inS2, int32_pl inS3, int32_pl inS4, int32_pl inS1, int32_pl inS2, int32_pl inS3, int32_pl inS4,
int32_al[inS1][inS2][inS3][inS4] inputArr, int32_al[inS1][inS2][inS3][inS4] inputArr,
int32_pl[2] axes, int32_al[2] axes,
int32_al[outS1][outS2] outputArr int32_al[outS1][outS2] outputArr
) )
{ {
...@@ -332,4 +332,4 @@ def void StartComputation() ...@@ -332,4 +332,4 @@ def void StartComputation()
def void EndComputation() def void EndComputation()
{ {
return; return;
} }
\ No newline at end of file
...@@ -278,7 +278,7 @@ def void FusedBatchNorm4411(int32_pl s1, int32_pl s2, int32_pl s3, int32_pl s4, ...@@ -278,7 +278,7 @@ def void FusedBatchNorm4411(int32_pl s1, int32_pl s2, int32_pl s3, int32_pl s4,
def void ReduceMean24(int32_pl outS1, int32_pl outS2, def void ReduceMean24(int32_pl outS1, int32_pl outS2,
int32_pl inS1, int32_pl inS2, int32_pl inS3, int32_pl inS4, int32_pl inS1, int32_pl inS2, int32_pl inS3, int32_pl inS4,
int64_al[inS1][inS2][inS3][inS4] inputArr, int64_al[inS1][inS2][inS3][inS4] inputArr,
int32_pl[2] axes, int64_al[2] axes,
int64_al[outS1][outS2] outputArr int64_al[outS1][outS2] outputArr
) )
{ {
...@@ -332,4 +332,4 @@ def void StartComputation() ...@@ -332,4 +332,4 @@ def void StartComputation()
def void EndComputation() def void EndComputation()
{ {
return; return;
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment