test_mean_op.py 457 字节
Newer Older
L
liaogang 已提交
1 2
import unittest
import numpy as np
Q
qijun 已提交
3
from op_test import OpTest
L
liaogang 已提交
4 5


Q
qijun 已提交
6
class TestMeanOp(OpTest):
L
liaogang 已提交
7
    def setUp(self):
Q
qijun 已提交
8 9 10
        self.op_type = "mean"
        self.inputs = {'X': np.random.random((10, 10)).astype("float32")}
        self.outputs = {'Out': np.mean(self.inputs["X"])}
L
liaogang 已提交
11

Q
qijun 已提交
12 13
    def test_check_output(self):
        self.check_output()
L
liaogang 已提交
14

Q
qijun 已提交
15 16
    def test_checkout_grad(self):
        self.check_grad(['X'], 'Out')
17 18


Q
qijun 已提交
19
if __name__ == "__main__":
L
liaogang 已提交
20
    unittest.main()