-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add layer_norm e2e test with stash_type (#399)
`python run.py --mode=cl-onnx-iree -v --torchtolinalg -t layer_norm_test`
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright 2024 Advanced Micro Devices, Inc. | ||
# | ||
# Licensed under the Apache License v2.0 with LLVM Exceptions. | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
from onnx import TensorProto | ||
from onnx.helper import make_node, make_tensor_value_info | ||
|
||
from ..helper_classes import BuildAModel | ||
from e2e_testing.registry import register_test | ||
|
||
class LayerNormalizationModel(BuildAModel): | ||
def construct_i_o_value_info(self): | ||
X = make_tensor_value_info("X", TensorProto.FLOAT16, [2, 3, 5]) | ||
Scale = make_tensor_value_info("Scale", TensorProto.FLOAT16, [5]) | ||
B = make_tensor_value_info("B", TensorProto.FLOAT16, [5]) | ||
Y = make_tensor_value_info("Y", TensorProto.FLOAT16, [2, 3, 5]) | ||
Mean = make_tensor_value_info("Mean", TensorProto.FLOAT, [2, 3, 1]) | ||
InvStdDev = make_tensor_value_info("InvStdDev", TensorProto.FLOAT, [2, 3, 1]) | ||
self.input_vi = [X, Scale, B] | ||
self.output_vi = [Y, Mean, InvStdDev] | ||
|
||
def construct_nodes(self): | ||
layer_norm_node = make_node( | ||
op_type="LayerNormalization", | ||
inputs=["X", "Scale", "B"], | ||
outputs=["Y", "Mean", "InvStdDev"], | ||
axis=-1, | ||
epsilon=1e-05, | ||
stash_type=1, | ||
) | ||
self.node_list = [layer_norm_node] | ||
|
||
register_test(LayerNormalizationModel, "layer_norm_test") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ | |
from .conv import * | ||
from .convtranspose import * | ||
from .tfidf_vectorizer import * | ||
from .layer_norm import * |