未验证 提交 6f7e768c 编写于 作者: C carryyu 提交者: GitHub

test=infer-coverage fix A10 test_fc_elementwise_layernorm_fuse_pass (#46651)

上级 89d481db
...@@ -20,6 +20,19 @@ import unittest ...@@ -20,6 +20,19 @@ import unittest
import hypothesis.strategies as st import hypothesis.strategies as st
class FcElementLayernormFusePassDataGen:
def __init__(self, min_v, max_v, shape, dtype):
self.min_v = min_v
self.max_v = max_v
self.shape = shape
self.dtype = dtype
def __call__(self):
return np.random.normal(self.min_v, self.max_v,
self.shape).astype(self.dtype)
class TestFCElementwiseLayerNormFusePass(PassAutoScanTest): class TestFCElementwiseLayerNormFusePass(PassAutoScanTest):
""" """
x_var w(persistable) bias_var(persistable) x_var w(persistable) bias_var(persistable)
...@@ -116,11 +129,18 @@ class TestFCElementwiseLayerNormFusePass(PassAutoScanTest): ...@@ -116,11 +129,18 @@ class TestFCElementwiseLayerNormFusePass(PassAutoScanTest):
program_config = ProgramConfig( program_config = ProgramConfig(
ops=ops, ops=ops,
weights={ weights={
"fc_w": TensorConfig(shape=w_shape), "fc_w":
"fc_bias": TensorConfig(shape=fc_bias_shape), TensorConfig(shape=w_shape),
"add_bias": TensorConfig(shape=add_bias_shape), "fc_bias":
"scale": TensorConfig(shape=layer_norm_shape), TensorConfig(shape=fc_bias_shape),
"layer_norm_bias": TensorConfig(shape=layer_norm_shape), "add_bias":
TensorConfig(shape=add_bias_shape),
"scale":
TensorConfig(shape=layer_norm_shape,
data_gen=FcElementLayernormFusePassDataGen(
0.0, 0.5, layer_norm_shape, np.float32)),
"layer_norm_bias":
TensorConfig(shape=layer_norm_shape),
}, },
inputs={ inputs={
"fc_x": TensorConfig(shape=x_shape), "fc_x": TensorConfig(shape=x_shape),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册