test_sigmoid_op.py 694 字节
Newer Older
Q
qijun 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
import unittest
from op_test_util import OpTestMeta
import numpy as np


class TestSigmoidOp(unittest.TestCase):
    __metaclass__ = OpTestMeta

    def setUp(self):
        self.type = "sigmoid"
        self.X = np.random.random((32, 100)).astype("float32")
        self.Y = 1 / (1 + np.exp(-self.X))


15 16 17 18 19 20 21 22 23 24 25
#class TestSigmoidGradOp(unittest.TestCase):
#    __metaclass__ = OpTestMeta
#
#    def setUp(self):
#        self.type = "sigmoid_grad"
#        self.Y = np.random.random((32, 100)).astype("float32")
#        self.dY = np.random.random((32, 100)).astype("float32")
#        self.dX = self.dY * self.Y * (1 - self.Y)
#        print self.dX
#

Q
qijun 已提交
26 27
if __name__ == '__main__':
    unittest.main()