Refine the cpu code.

Adaptive_data_structure_for_SwitchOrderLayer
hedaoyuan 8 years ago
parent 6efbe2ff43
commit f7be9cb97a

@ -1,8 +1,8 @@
if(WITH_GPU)
nv_library(math_function SRCS math_function.cc math_function.cu DEPS cblas device_context)
nv_library(math_function SRCS math_function.cc math_function.cu im2col.cc DEPS cblas device_context)
else()
cc_library(math_function SRCS math_function.cc DEPS cblas device_context)
cc_library(math_function SRCS math_function.cc im2col.cc DEPS cblas device_context)
endif()
nv_test(math_function_test SRCS math_function_test.cc DEPS math_function tensor)

File diff suppressed because it is too large Load Diff

@ -14,8 +14,8 @@ limitations under the License. */
#pragma once
#include "TensorShape.h"
#include "TensorType.h"
#include "paddle/framework/tensor.h"
#include "paddle/platform/device_context.h"
namespace paddle {
@ -67,20 +67,20 @@ enum ColFormat { kCFO = 0, kOCF = 1 };
* \note The caller needs to ensure that imShape.inputChannels is equal to
* colShape.inputChannels.
*/
template <ColFormat Format, DeviceType Device, class T>
template <ColFormat Format, typename Place, typename T>
class Im2ColFunctor {
public:
void operator()(const T* imData, const TensorShape& imShape, T* colData,
const TensorShape& colShape, int strideHeight,
int strideWidth, int paddingHeight, int paddingWidth);
void operator()(const framework::Tensor& im, framework::Tensor& col,
int stride_height, int stride_width, int padding_height,
int padding_width);
};
template <ColFormat Format, DeviceType Device, class T>
template <ColFormat Format, typename Place, typename T>
class Col2ImFunctor {
public:
void operator()(T* imData, const TensorShape& imShape, const T* colData,
const TensorShape& colShape, int strideHeight,
int strideWidth, int paddingHeight, int paddingWidth);
void operator()(framework::Tensor& im, const framework::Tensor& col,
int stride_height, int stride_width, int padding_height,
int padding_width);
};
} // namespace paddle

Loading…
Cancel
Save