Skip to content

Commit 24904b9

Browse files
committed
Unique key for input data
1 parent 32929cd commit 24904b9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

paddle/fluid/operators/activation_mkldnn_op.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ void eltwise_forward(const ExecContext &ctx, mkldnn::algorithm algorithm,
5858
std::vector<int> src_tz = framework::vectorize2int(src->dims());
5959

6060
const std::string key = gethash(src_tz, algorithm);
61-
const std::string key_src_data = key + "@eltwise_fwd_src_data";
61+
const std::string key_src_data =
62+
key + ctx.op().Output("Out") + "@eltwise_fwd_src_data";
6263
const std::string key_src_mem = key + "@eltwise_fwd_src_mem";
6364
const std::string key_dst_mem = key + "@eltwise_fwd_dst_mem";
6465
const std::string key_fwd = key + "@eltwise_fwd";
@@ -140,7 +141,8 @@ void eltwise_grad(const ExecContext &ctx, mkldnn::algorithm algorithm,
140141
const std::string key_diff_dst_mem = key + "@eltwise_diff_dst_mem";
141142
const std::string key_grad = key + "@eltwise_grad";
142143

143-
const std::string key_src_data = key + "@eltwise_fwd_src_data";
144+
const std::string key_src_data =
145+
key + ctx.op().Input("Out") + "@eltwise_fwd_src_data";
144146
const auto p_src_data =
145147
std::static_pointer_cast<T *>(dev_ctx.GetBlob(key_src_data));
146148

0 commit comments

Comments
 (0)