提交 e9082bb7 编写于 作者: D dangqingqing

Resume unit testing.

上级 884ce5d5
...@@ -23,8 +23,6 @@ template <typename T> ...@@ -23,8 +23,6 @@ template <typename T>
__global__ void CrossEntropyGradientKernel(T* dX, const T* dY, const T* X, __global__ void CrossEntropyGradientKernel(T* dX, const T* dY, const T* X,
const int64_t* label, const int N, const int64_t* label, const int N,
const int D) { const int D) {
// TOOD(qingqing) define CUDA_1D_KERNEL_LOOP macro in a common file.
// CUDA_1D_KERNEL_LOOP(i, N) {
for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < N; for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < N;
i += blockDim.x * gridDim.x) { i += blockDim.x * gridDim.x) {
int idx = i * D + label[i]; int idx = i * D + label[i];
......
...@@ -240,7 +240,7 @@ void axpy<platform::GPUPlace, float>(const platform::DeviceContext& context, ...@@ -240,7 +240,7 @@ void axpy<platform::GPUPlace, float>(const platform::DeviceContext& context,
PADDLE_ENFORCE(platform::dynload::cublasSaxpy( PADDLE_ENFORCE(platform::dynload::cublasSaxpy(
reinterpret_cast<const platform::CUDADeviceContext&>(context) reinterpret_cast<const platform::CUDADeviceContext&>(context)
.cublas_handle(), .cublas_handle(),
n, alpha, x, 1, y, 1)); n, &alpha, x, 1, y, 1));
} }
template <> template <>
...@@ -250,7 +250,7 @@ void axpy<platform::GPUPlace, double>(const platform::DeviceContext& context, ...@@ -250,7 +250,7 @@ void axpy<platform::GPUPlace, double>(const platform::DeviceContext& context,
PADDLE_ENFORCE(platform::dynload::cublasDaxpy( PADDLE_ENFORCE(platform::dynload::cublasDaxpy(
reinterpret_cast<const platform::CUDADeviceContext&>(context) reinterpret_cast<const platform::CUDADeviceContext&>(context)
.cublas_handle(), .cublas_handle(),
n, alpha, x, 1, y, 1)); n, &alpha, x, 1, y, 1));
} }
template struct SetConstant<platform::GPUPlace, float>; template struct SetConstant<platform::GPUPlace, float>;
...@@ -270,7 +270,7 @@ DEFINE_GPU_TRANS(6); ...@@ -270,7 +270,7 @@ DEFINE_GPU_TRANS(6);
struct TensorSetConstantGPU { struct TensorSetConstantGPU {
TensorSetConstantGPU(const platform::DeviceContext& context, TensorSetConstantGPU(const platform::DeviceContext& context,
framework::Tensor* tensor, float value) framework::Tensor* tensor, float value)
: context_(context), tensor_(tensor), value_(value) {} : context_(context), tensor_(tensor), value_(value) {}
template <typename T> template <typename T>
......
...@@ -65,10 +65,8 @@ class SequenceConvKernel : public framework::OpKernel<T> { ...@@ -65,10 +65,8 @@ class SequenceConvKernel : public framework::OpKernel<T> {
padding_trainable, context_start, context_length, padding_trainable, context_start, context_length,
context_stride, up_pad, down_pad); context_stride, up_pad, down_pad);
context.device_context().Finish();
math::matmul<Place, T>(context.device_context(), col, false, filter, false, math::matmul<Place, T>(context.device_context(), col, false, filter, false,
static_cast<T>(1.0), out, static_cast<T>(0.0)); static_cast<T>(1.0), out, static_cast<T>(0.0));
context.device_context().Finish();
} }
}; };
......
...@@ -180,7 +180,6 @@ class TestLstmOp(OpTest): ...@@ -180,7 +180,6 @@ class TestLstmOp(OpTest):
['Input', 'Weight', 'Bias'], ['Hidden'], max_relative_error=5e-4) ['Input', 'Weight', 'Bias'], ['Hidden'], max_relative_error=5e-4)
"""
class TestLstmOpHasInitial(TestLstmOp): class TestLstmOpHasInitial(TestLstmOp):
def set_argument(self): def set_argument(self):
self.lod = [[0, 2, 5, 7]] self.lod = [[0, 2, 5, 7]]
...@@ -281,7 +280,7 @@ class TestLstmOpNotUsePeepholes(TestLstmOp): ...@@ -281,7 +280,7 @@ class TestLstmOpNotUsePeepholes(TestLstmOp):
self.has_initial_state = False self.has_initial_state = False
self.is_reverse = True self.is_reverse = True
self.use_peepholes = False self.use_peepholes = False
"""
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
...@@ -122,7 +122,7 @@ class TestSeqProject(OpTest): ...@@ -122,7 +122,7 @@ class TestSeqProject(OpTest):
max_relative_error=0.05, max_relative_error=0.05,
no_grad_set=set(['X', 'Filter'])) no_grad_set=set(['X', 'Filter']))
def not_test_check_grad_Filter(self): def test_check_grad_Filter(self):
self.check_grad( self.check_grad(
['Filter'], ['Filter'],
'Out', 'Out',
...@@ -165,33 +165,34 @@ class TestSeqProject(OpTest): ...@@ -165,33 +165,34 @@ class TestSeqProject(OpTest):
self.output_represention = 8 # output feature size self.output_represention = 8 # output feature size
#class TestSeqProjectCase1(TestSeqProject): class TestSeqProjectCase1(TestSeqProject):
# def init_test_case(self): def init_test_case(self):
# self.input_row = 11 self.input_row = 11
# self.context_start = -1 self.context_start = -1
# self.context_length = 3 self.context_length = 3
# self.padding_trainable = True self.padding_trainable = True
# self.context_stride = 1 self.context_stride = 1
#
# self.input_size = [self.input_row, 23] self.input_size = [self.input_row, 23]
# self.lod = [[0, 4, 5, 8, self.input_row]] self.lod = [[0, 4, 5, 8, self.input_row]]
# self.output_represention = 8 # output feature size self.output_represention = 8 # output feature size
#
#
#class TestSeqProjectCase2(TestSeqProject): class TestSeqProjectCase2(TestSeqProject):
# def init_test_case(self): def init_test_case(self):
# self.input_row = 25 self.input_row = 25
# self.context_start = 2 self.context_start = 2
# self.context_length = 3 self.context_length = 3
# self.padding_trainable = True self.padding_trainable = True
# self.context_stride = 1 self.context_stride = 1
#
# self.input_size = [self.input_row, 23] self.input_size = [self.input_row, 23]
# idx = range(self.input_size[0]) idx = range(self.input_size[0])
# del idx[0] del idx[0]
# self.lod = [[0] + np.sort(random.sample(idx, 8)).tolist() + self.lod = [[0] + np.sort(random.sample(idx, 8)).tolist() +
# [self.input_size[0]]] [self.input_size[0]]]
# self.output_represention = 8 # output feature size self.output_represention = 8 # output feature size
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册