未验证 提交 2182a4f9 编写于 作者: J Jacek Czaja 提交者: GitHub

- Modified mem_desc() to return reference to Tensor::memory::desc to (#47844)

avoid copying
上级 9191e743
......@@ -116,7 +116,7 @@ following codes there.
#ifdef PADDLE_WITH_MKLDNN
public:
dnnl::memory::desc mem_desc() const;
const dnnl::memory::desc& mem_desc() const;
inline void set_mem_desc(const dnnl::memory::desc& mem_desc) {
mem_desc_ = mem_desc;
......
......@@ -344,7 +344,7 @@ std::vector<DenseTensor> DenseTensor::Chunk(int64_t chunks,
}
#ifdef PADDLE_WITH_MKLDNN
dnnl::memory::desc DenseTensor::mem_desc() const { return mem_desc_; }
const dnnl::memory::desc& DenseTensor::mem_desc() const { return mem_desc_; }
#endif
// NOTE: For historical reasons, this interface has a special behavior,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册