Skip to content

Commit 168b4be

Browse files
committed
add tests
1 parent 44c78d0 commit 168b4be

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed
Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
[
22
{
3-
"test": "print(your_function(...))",
4-
"expected_output": "..."
3+
"test": "import numpy as np\ndef f1(x): return x + 1\ndef f2(x): return x * 2\ndef f3(x): return x - 3\nfuncs = [f1, f2, f3]\ninput_arr = np.array([1.0, 2.0])\nprint(checkpoint_forward(funcs, input_arr))",
4+
"expected_output": "[1. 3.]"
5+
},
6+
{
7+
"test": "import numpy as np\ndef f1(x): return x * 0\ndef f2(x): return x + 10\nfuncs = [f1, f2]\ninput_arr = np.array([5.0, 7.0])\nprint(checkpoint_forward(funcs, input_arr))",
8+
"expected_output": "[10. 10.]"
9+
},
10+
{
11+
"test": "import numpy as np\ndef f1(x): return x / 2\ndef f2(x): return x ** 2\nfuncs = [f1, f2]\ninput_arr = np.array([4.0, 8.0])\nprint(checkpoint_forward(funcs, input_arr))",
12+
"expected_output": "[ 4. 16.]"
13+
},
14+
{
15+
"test": "import numpy as np\ndef f1(x): return x - 1\nfuncs = [f1]\ninput_arr = np.array([10.0, 20.0])\nprint(checkpoint_forward(funcs, input_arr))",
16+
"expected_output": "[ 9. 19.]"
17+
},
18+
{
19+
"test": "import numpy as np\nfuncs = []\ninput_arr = np.array([1.0, 2.0])\nprint(checkpoint_forward(funcs, input_arr))",
20+
"expected_output": "[1. 2.]"
521
}
622
]

0 commit comments

Comments
 (0)