From 82a7d9096bbba5316e4f485e97de53f41ecb75cb Mon Sep 17 00:00:00 2001 From: seockho-kim Date: Tue, 24 Sep 2024 07:41:16 +0900 Subject: [PATCH] [res] CircleRecipes and TFLiteRecipes added for RmsNorm (#14022) This commit adds RmsNorm test recipe in CircleRecipes/TFLiteRecipes. ONE-DCO-1.0-Signed-off-by: Seockho Kim seockho.kim@samsung.com --- res/CircleRecipes/RmsNorm_000/test.recipe | 46 +++++++ res/CircleRecipes/RmsNorm_000/test.reverse | 0 .../Net_RmsNorm_000/test.recipe | 117 ++++++++++++++++++ .../Net_RmsNorm_000/test.rule | 7 ++ 4 files changed, 170 insertions(+) create mode 100644 res/CircleRecipes/RmsNorm_000/test.recipe create mode 100644 res/CircleRecipes/RmsNorm_000/test.reverse create mode 100644 res/TensorFlowLiteRecipes/Net_RmsNorm_000/test.recipe create mode 100644 res/TensorFlowLiteRecipes/Net_RmsNorm_000/test.rule diff --git a/res/CircleRecipes/RmsNorm_000/test.recipe b/res/CircleRecipes/RmsNorm_000/test.recipe new file mode 100644 index 00000000000..e5e0c30df14 --- /dev/null +++ b/res/CircleRecipes/RmsNorm_000/test.recipe @@ -0,0 +1,46 @@ +operand { + name: "ifm" + type: FLOAT32 + shape { dim: 1 dim: 3 dim: 3 dim: 4 } +} +operand { + name: "gamma" + type: FLOAT32 + shape { dim: 4 } + filler { + tag: "explicit" + arg: "1.0" + arg: "1.0" + arg: "1.0" + arg: "1.0" + } +} +operand { + name: "beta" + type: FLOAT32 + shape { dim: 4 } + filler { + tag: "explicit" + arg: "0.0" + arg: "0.0" + arg: "0.0" + arg: "0.0" + } +} +operand { + name: "ofm" + type: FLOAT32 + shape { dim: 1 dim: 3 dim: 3 dim: 4 } +} +operation { + type: "RmsNorm" + input: "ifm" + input: "gamma" + input: "beta" + output: "ofm" + rms_norm_options { + epsilon: 0.0001 + } +} +input: "ifm" +output: "ofm" diff --git a/res/CircleRecipes/RmsNorm_000/test.reverse b/res/CircleRecipes/RmsNorm_000/test.reverse new file mode 100644 index 00000000000..e69de29bb2d diff --git a/res/TensorFlowLiteRecipes/Net_RmsNorm_000/test.recipe b/res/TensorFlowLiteRecipes/Net_RmsNorm_000/test.recipe new file mode 100644 index 00000000000..b89984abfee --- /dev/null +++ b/res/TensorFlowLiteRecipes/Net_RmsNorm_000/test.recipe @@ -0,0 +1,117 @@ +operand { + name: "Input" + type: FLOAT32 + shape { + dim: 1 + dim: 1 + dim: 4 + } +} +operand { + name: "RmsNorm/Mul/Square" + type: FLOAT32 + shape { + dim: 1 + dim: 1 + dim: 4 + } +} +operand { + name: "RmsNorm/Mean/Axis" + type: INT32 + shape { + } + filler { + tag: "explicit" + arg: "-1" + } +} +operand { + name: "RmsNorm/Mean/MeanSquare" + type: FLOAT32 + shape { + dim: 1 + dim: 1 + dim: 1 + } +} +operand { + name: "RmsNorm/Add/Epsilon" + type: FLOAT32 + shape { + } + filler { + tag: "explicit" + arg: "1e-06" + } +} +operand { + name: "RmsNorm/Add/MeanSquare_plus_eps" + type: FLOAT32 + shape { + dim: 1 + dim: 1 + dim: 1 + } +} +operand { + name: "RmsNorm/Sqrt/RMS" + type: FLOAT32 + shape { + dim: 1 + dim: 1 + dim: 1 + } +} +operand { + name: "RmsNorm/Mul/RmsNorm" + type: FLOAT32 + shape { + dim: 1 + dim: 1 + dim: 4 + } +} +operation { + type: "Mul" + input: "Input" + input: "Input" + output: "RmsNorm/Mul/Square" + mul_options { + activation: NONE + } +} +operation { + type: "Mean" + input: "RmsNorm/Mul/Square" + input: "RmsNorm/Mean/Axis" + output: "RmsNorm/Mean/MeanSquare" + mean_options { + keep_dims: true + } +} +operation { + type: "Add" + input: "RmsNorm/Mean/MeanSquare" + input: "RmsNorm/Add/Epsilon" + output: "RmsNorm/Add/MeanSquare_plus_eps" + add_options { + activation: NONE + } +} +operation { + type: "Rsqrt" + input: "RmsNorm/Add/MeanSquare_plus_eps" + output: "RmsNorm/Sqrt/RMS" +} +operation { + type: "Mul" + input: "Input" + input: "RmsNorm/Sqrt/RMS" + output: "RmsNorm/Mul/RmsNorm" + mul_options { + activation: NONE + } +} +input: "Input" +output: "RmsNorm/Mul/RmsNorm" diff --git a/res/TensorFlowLiteRecipes/Net_RmsNorm_000/test.rule b/res/TensorFlowLiteRecipes/Net_RmsNorm_000/test.rule new file mode 100644 index 00000000000..1586fc89482 --- /dev/null +++ b/res/TensorFlowLiteRecipes/Net_RmsNorm_000/test.rule @@ -0,0 +1,7 @@ +# To check if this network is converted to circle RmsNorm op + +RULE "VERIFY_FILE_FORMAT" $(verify_file_format) '=' 1 + +RULE "RMS_NORM_EXIST" $(op_count RMS_NORM) '=' 1 +RULE "NO_ADD" $(op_count ADD) '=' 0 +RULE "NO_MUL" $(op_count MUL) '=' 0