File tree 2 files changed +2
-21
lines changed
2 files changed +2
-21
lines changed Original file line number Diff line number Diff line change @@ -294,22 +294,8 @@ void MKLDNNLayer::resetMergeGrad(MKLDNNMatrixPtr& out) {
294
294
srcs.push_back (*src);
295
295
}
296
296
297
- // TODO(TJ): remove me when mkldnn sum support different formats
298
- for (size_t i = 1 ; i < srcPDs.size (); ++i) {
299
- CHECK (srcPDs[0 ] == srcPDs[i]);
300
- }
301
- tmpOutGrad_ = out;
302
- tmpCvt_ = nullptr ;
303
- if (out->getPrimitiveDesc () != srcPDs[0 ]) {
304
- tmpOutGrad_ = MKLDNNMatrix::create (srcPDs[0 ]);
305
- tmpCvt_ = MKLDNNMatrix::createReorder (tmpOutGrad_, out);
306
- CHECK (tmpCvt_);
307
- pipelineMergeGrad_.push_back (*tmpCvt_);
308
- }
309
-
310
- auto sumPD =
311
- sum::primitive_desc (tmpOutGrad_->getMemoryDesc (), scales, srcPDs);
312
- mergeGrad_.reset (new sum (sumPD, srcs, *tmpOutGrad_));
297
+ auto sumPD = sum::primitive_desc (out->getMemoryDesc (), scales, srcPDs);
298
+ mergeGrad_.reset (new sum (sumPD, srcs, *out));
313
299
pipelineMergeGrad_.insert (pipelineMergeGrad_.begin (), *mergeGrad_);
314
300
}
315
301
Original file line number Diff line number Diff line change @@ -94,11 +94,6 @@ class MKLDNNLayer : public Layer {
94
94
std::vector<mkldnn::primitive> pipelineMergeGrad_;
95
95
// tmp input argument to save input grad, only used to merge grad
96
96
Argument tmpInArg_;
97
- // since mkldnn sum do not support different formats:
98
- // can refer to https://github.com/01org/mkl-dnn/issues/134
99
- // so need create reorder manually and save tmp MKLDNNMatrix
100
- MKLDNNMatrixPtr tmpOutGrad_;
101
- std::shared_ptr<mkldnn::primitive> tmpCvt_;
102
97
103
98
public:
104
99
explicit MKLDNNLayer (const LayerConfig& config)
You can’t perform that action at this time.
0 commit comments