@@ -195,7 +195,7 @@ int FCLstmFusePass::BuildFusion(Graph* graph,
195195 Node* cell,
196196 Node* xx,
197197 Node* fc_bias,
198- const bool use_mkldnn ) {
198+ const bool use_onednn ) {
199199 OpDesc op_desc;
200200 op_desc.SetType (" fusion_lstm" );
201201#define SET_IN (Key, node__ ) op_desc.SetInput(#Key, {node__->Name ()});
@@ -235,7 +235,7 @@ int FCLstmFusePass::BuildFusion(Graph* graph,
235235 op_desc.SetOutput (" XX" , {xx->Name ()});
236236 op_desc.SetAttr (" is_reverse" , lstm->Op ()->GetAttr (" is_reverse" ));
237237 op_desc.SetAttr (" use_peepholes" , lstm->Op ()->GetAttr (" use_peepholes" ));
238- op_desc.SetAttr (" use_mkldnn " , use_mkldnn );
238+ op_desc.SetAttr (" use_onednn " , use_onednn );
239239 // TODO(TJ): get from attr
240240 op_desc.SetAttr (" use_seq" , true );
241241
@@ -300,8 +300,9 @@ int FCLstmFusePass::BuildFusion(Graph* graph,
300300 GET_IR_NODE_FROM_SUBGRAPH (Cell, Cell, lstm_pattern);
301301 GET_IR_NODE_FROM_SUBGRAPH (w, w, fc_pattern);
302302 GET_IR_NODE_FROM_SUBGRAPH (mul, mul, fc_pattern);
303- const bool use_mkldnn =
304- (mul->Op ()->GetAttrIfExists <bool >(" use_mkldnn" ) &&
303+ const bool use_onednn =
304+ ((mul->Op ()->GetAttrIfExists <bool >(" use_mkldnn" ) ||
305+ mul->Op ()->GetAttrIfExists <bool >(" use_onednn" )) &&
305306 lstm->Op ()->GetAttrIfExists <std::string>(" gate_activation" ) ==
306307 " sigmoid" &&
307308 lstm->Op ()->GetAttrIfExists <std::string>(" cell_activation" ) ==
@@ -323,7 +324,7 @@ int FCLstmFusePass::BuildFusion(Graph* graph,
323324 Cell,
324325 fc_out,
325326 fc_bias,
326- use_mkldnn );
327+ use_onednn );
327328 // Remove unneeded nodes.
328329 std::unordered_set<const Node*> marked_nodes (
329330 {mul, lstm, elementwise_add, mul_out, BatchGate, BatchCellPreAct});
@@ -339,7 +340,7 @@ int FCLstmFusePass::BuildFusion(Graph* graph,
339340 Cell,
340341 fc_out,
341342 nullptr ,
342- use_mkldnn );
343+ use_onednn );
343344 // Remove unneeded nodes.
344345 std::unordered_set<const Node*> marked_nodes (
345346 {mul, lstm, BatchGate, BatchCellPreAct});
0 commit comments