Skip to content

Commit 61c54db

Browse files
committed
Remove additional function of the code
1 parent b8a04c2 commit 61c54db

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

paddle/fluid/framework/data_layout_transform.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ void TransDataLayoutFromMKLDNN(const OpKernelType& kernel_type_for_var,
147147
"Input tensor type is not supported: ", in.type().name());
148148
memory::data_type out_type = in_type;
149149

150-
auto in_format = MKLDNNFormatForSize(in_tz.size(), in.format());
150+
auto in_format = platform::MKLDNNFormatForSize(in_tz.size(), in.format());
151151
auto out_format =
152-
MKLDNNFormatForSize(in_tz.size(), ToMKLDNNFormat(out_layout));
152+
platform::MKLDNNFormatForSize(in_tz.size(), ToMKLDNNFormat(out_layout));
153153

154154
void* in_data = GetDataFromTensor(in, in_type);
155155

paddle/fluid/framework/data_layout_transform.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@ inline MKLDNNDataType ToMKLDNNDataType(const std::type_index type) {
6262
return MKLDNNDataType::data_undef;
6363
}
6464

65-
inline MKLDNNFormat MKLDNNFormatForSize(size_t dims_size,
66-
MKLDNNFormat default_format) {
67-
return (dims_size == 1
68-
? mkldnn::memory::format::x
69-
: dims_size == 2 ? mkldnn::memory::format::nc : default_format);
70-
}
7165
#endif
7266

7367
void TransDataLayoutFromMKLDNN(const OpKernelType& kernel_type_for_var,

paddle/fluid/framework/data_transform.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ limitations under the License. */
1818
#include "paddle/fluid/framework/data_layout_transform.h"
1919
#include "paddle/fluid/framework/data_type_transform.h"
2020

21+
#ifdef PADDLE_WITH_MKLDNN
22+
#include "paddle/fluid/platform/mkldnn_helper.h"
23+
#endif
24+
2125
namespace paddle {
2226
namespace framework {
2327

@@ -48,8 +52,8 @@ void DataTransform(const OpKernelType& expected_kernel_type,
4852
// Case1 - transform from Non-MKLDNN OPKernel to MKLDNN OPKernel
4953
// Just set layout/format. No real transform occur
5054

51-
auto out_format =
52-
MKLDNNFormatForSize(in.dims().size(), ToMKLDNNFormat(lin));
55+
auto out_format = platform::MKLDNNFormatForSize(in.dims().size(),
56+
ToMKLDNNFormat(lin));
5357

5458
out.ShareDataWith(input_tensor);
5559
out.set_layout(DataLayout::kMKLDNN);

0 commit comments

Comments
 (0)