Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

Commit 78e3c8f

Browse files
author
Yang Yang
committed
add test skeleton
1 parent 051d42a commit 78e3c8f

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

src/backward.cc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "src/tape.h"
16+
17+
namespace paddle {
18+
namespace tape {} // namespace tape
19+
} // namespace paddle

src/test_backward.cc

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "gtest/gtest.h"
16+
#include "src/function.h"
17+
18+
/*
19+
* y = op(x)
20+
* z = op(x)
21+
* loss = y + z
22+
*/
23+
TEST(Backward, TestMultipleAssignment) {}
24+
25+
/*
26+
* loss = x + x
27+
*/
28+
TEST(Backward, TestInplaceSum) {}
29+
30+
/*
31+
* y = op(x) // y@grad is not initialized
32+
* loss = op(z)
33+
*/
34+
TEST(Backward, TestEmptyGrad) {}
35+
36+
/*
37+
* vector<> v
38+
* for i in dim(x, 0):
39+
* y = x.Slice(i)
40+
* out = linear(y)
41+
* v.push_back(out)
42+
* loss = v.back()
43+
*/
44+
TEST(Backward, TestForLoop) {}
45+
46+
int main(int argc, char** argv) {
47+
std::vector<paddle::platform::Place> places;
48+
places.emplace_back(paddle::platform::CPUPlace());
49+
paddle::platform::DeviceContextPool::Init(places);
50+
51+
testing::InitGoogleTest(&argc, argv);
52+
return RUN_ALL_TESTS();
53+
}

0 commit comments

Comments
 (0)