mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-11 17:48:34 +00:00
deprecate frontend layernorm postpass (#4372)
This commit is contained in:
parent
7fea332f93
commit
7ec9a73202
2 changed files with 12 additions and 11 deletions
|
|
@ -17,7 +17,6 @@ def run_postprocess(model):
|
|||
# this post pass is not required for pytorch > 1.6
|
||||
model = fuse_softmaxNLL_to_softmaxCE(model)
|
||||
|
||||
model = layer_norm_transform(model)
|
||||
model = fix_expand_shape(model)
|
||||
model = fix_expand_shape_pt_1_5(model)
|
||||
return model
|
||||
|
|
@ -207,21 +206,23 @@ def add_const(model, name, output, t_value = None, f_value = None):
|
|||
return const_node
|
||||
|
||||
def layer_norm_transform(model):
|
||||
# DEPRECATED: This pass is no longer needed as the transform is handled at the backend.
|
||||
# Converting below subgraph
|
||||
#
|
||||
# input
|
||||
# |
|
||||
# ReduceMean
|
||||
# __|_____
|
||||
# | |
|
||||
# Sub Sub
|
||||
# | |
|
||||
# | (optional) Cast
|
||||
# | |
|
||||
# |
|
||||
# Sub Constant
|
||||
# _||_____ |
|
||||
# | | |
|
||||
# | | |
|
||||
# | (optional) Cast (optional) Cast
|
||||
# | | |
|
||||
# | | ____________________|
|
||||
# | | |
|
||||
# | Pow
|
||||
# | |
|
||||
# | (optional) Cast
|
||||
# | |
|
||||
# | ReduceMean
|
||||
# | |
|
||||
# | Add
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class Test_PostPasses(unittest.TestCase):
|
|||
count_layer_norm = self.count_nodes(onnx_model, "LayerNormalization")
|
||||
count_nodes = self.count_all_nodes(onnx_model)
|
||||
|
||||
assert count_layer_norm == 1
|
||||
assert count_layer_norm == 0
|
||||
assert count_nodes == 3
|
||||
|
||||
def test_expand(self):
|
||||
|
|
@ -199,7 +199,7 @@ class Test_PostPasses(unittest.TestCase):
|
|||
def _bert_helper(self, onnx_model):
|
||||
# count layer_norm
|
||||
count_layer_norm = self.count_nodes(onnx_model, "LayerNormalization")
|
||||
assert count_layer_norm == 12
|
||||
assert count_layer_norm == 0
|
||||
|
||||
# get expand node and check output shape
|
||||
expand_nodes = self.find_nodes(onnx_model, "Expand")
|
||||
|
|
|
|||
Loading…
Reference in a new issue