未验证 提交 26c573de 编写于 作者: W whs 提交者: GitHub

Change bias to persistable in preln_residual_bias_fuse_pass (#45037)

上级 49d2a778
...@@ -61,7 +61,8 @@ void PrelnResidualBias::operator()(PDNode *x, PDNode *y) { ...@@ -61,7 +61,8 @@ void PrelnResidualBias::operator()(PDNode *x, PDNode *y) {
auto *elementwise0 = auto *elementwise0 =
pattern->NewNode(elementwise0_repr())->assert_is_op("elementwise_add"); pattern->NewNode(elementwise0_repr())->assert_is_op("elementwise_add");
auto *elementwise_bias_var = pattern->NewNode(elementwise_bias_repr()) auto *elementwise_bias_var = pattern->NewNode(elementwise_bias_repr())
->assert_is_op_input("elementwise_add", "Y"); ->assert_is_op_input("elementwise_add", "Y")
->assert_is_persistable_var();
auto *elementwise0_out_var = pattern->NewNode(elementwise0_out_repr()) auto *elementwise0_out_var = pattern->NewNode(elementwise0_out_repr())
->assert_is_op_output("elementwise_add") ->assert_is_op_output("elementwise_add")
->assert_is_op_input("elementwise_add") ->assert_is_op_input("elementwise_add")
......
...@@ -66,8 +66,8 @@ class PrelnResidualBiasOpConverter : public OpConverter { ...@@ -66,8 +66,8 @@ class PrelnResidualBiasOpConverter : public OpConverter {
nvinfer1::ILayer* layer = nullptr; nvinfer1::ILayer* layer = nullptr;
plugin::DynamicPluginTensorRT* plugin = nullptr; plugin::DynamicPluginTensorRT* plugin = nullptr;
if (with_fp16) { if (with_fp16) {
auto half_ele_bias_data = new half[bias_size]; auto half_ele_bias_data = new half[ele_bias_size];
for (int i = 0; i < bias_size; i++) { for (int i = 0; i < ele_bias_size; i++) {
half_ele_bias_data[i] = static_cast<half>(ele_bias[i]); half_ele_bias_data[i] = static_cast<half>(ele_bias[i]);
} }
plugin = new plugin::PrelnResidualBiasPluginDynamic(bias, plugin = new plugin::PrelnResidualBiasPluginDynamic(bias,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册