Skip to content

Commit

Permalink
add conv3d_trans_cudnn_op unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
chengduoZH committed Nov 13, 2017
1 parent 3a507b4 commit 6fb4bb8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
19 changes: 18 additions & 1 deletion paddle/operators/conv_transpose_cudnn_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,24 @@ class CudnnConv2DTransposeOpMaker : public Conv2DTransposeOpMaker {
framework::OpAttrChecker* op_checker)
: Conv2DTransposeOpMaker(proto, op_checker) {
AddAttr<std::vector<int>>("dilations", "dilations of convolution operator.")
.SetDefault(std::vector<int>{1, 1});
.SetDefault({1, 1});
AddAttr<int>("workspace_size_MB",
"workspace size for cudnn, in MB, "
"workspace is a section of GPU memory which will be "
"allocated/freed each time the operator runs, larger "
"workspace size can increase performance but also requires "
"better hardward. This size should be carefully setted.")
.SetDefault(4096);
}
};

class CudnnConv3DTransposeOpMaker : public Conv3DTransposeOpMaker {
public:
CudnnConv3DTransposeOpMaker(framework::OpProto* proto,
framework::OpAttrChecker* op_checker)
: Conv3DTransposeOpMaker(proto, op_checker) {
AddAttr<std::vector<int>>("dilations", "dilations of convolution operator.")
.SetDefault({1, 1, 1});
AddAttr<int>("workspace_size_MB",
"workspace size for cudnn, in MB, "
"workspace is a section of GPU memory which will be "
Expand Down
6 changes: 6 additions & 0 deletions python/paddle/v2/framework/tests/test_conv3d_transpose_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,11 @@ def init_op_type(self):
self.op_type = "conv3d_transpose"


# ------------ test_cudnn ------------
class TestCudnn(TestConv3dTransposeOp):
def init_op_type(self):
self.op_type = "conv3d_transpose_cudnn"


if __name__ == '__main__':
unittest.main()

0 comments on commit 6fb4bb8

Please sign in to comment.