diff --git a/paddle/phi/core/dense_tensor.h b/paddle/phi/core/dense_tensor.h index a740a9a5725d90a4b77f8793111407c53ecc8185..ef91319e1c961f4e126c509b9de3f95c450eac4e 100644 --- a/paddle/phi/core/dense_tensor.h +++ b/paddle/phi/core/dense_tensor.h @@ -190,6 +190,25 @@ class DenseTensor : public TensorBase, std::shared_ptr inplace_version_counter_{ std::make_shared()}; +/* @jim19930609: This is a hack +In general, it is badly designed to fuse MKLDNN-specific objects into a +generic Tensor. +We temporarily leave them here to unblock Tensor Unification progress. +In the final state, we should come up with a MKLDNN_Tensor and move the +following codes there. +*/ +#ifdef PADDLE_WITH_MKLDNN + /** + * @brief the detail format of memory block which have layout as kMKLDNN + * + * @note MKLDNN lib support various memory format like nchw, nhwc, nChw8C, + * nChw16c, etc. For a MKLDNN memory block, layout will be set as + * DataLayout::kMKLDNN meanwhile detail memory format will be kept in + * this field. + */ + dnnl::memory::format_tag format_ = dnnl::memory::format_tag::undef; +#endif + #ifndef PADDLE_WITH_CUSTOM_KERNEL #include "paddle/phi/core/dense_tensor.inl" #endif diff --git a/paddle/phi/core/dense_tensor.inl b/paddle/phi/core/dense_tensor.inl index 804360ea941ba0f0510c53efdf5cad1e591fc414..c6ca3c00cb558cf428c9b8ac781641db065287f3 100644 --- a/paddle/phi/core/dense_tensor.inl +++ b/paddle/phi/core/dense_tensor.inl @@ -133,17 +133,6 @@ inline void set_format(const dnnl::memory::format_tag format) { format_ = format; } -protected: -/** - * @brief the detail format of memory block which have layout as kMKLDNN - * - * @note MKLDNN lib support various memory format like nchw, nhwc, nChw8C, - * nChw16c, etc. For a MKLDNN memory block, layout will be set as - * DataLayout::kMKLDNN meanwhile detail memory format will be kept in - * this field. - */ - -dnnl::memory::format_tag format_ = dnnl::memory::format_tag::undef; #endif /* ------------------------------ */