diff --git a/advanced.tex b/advanced.tex index 15fb751..7fb463a 100644 --- a/advanced.tex +++ b/advanced.tex @@ -196,8 +196,7 @@ \section{How to Make an Op (Python)} \end{frame} \begin{frame}{Tests} -To test the \code{infer_shape} method we use \code{InferShapeTester} -\lstinputlisting[linerange={5-5,19-32}]{test_doubleop.py} +\lstinputlisting[linerange={5-5,20-34}]{test_doubleop.py} \end{frame} \begin{frame}{Gradient} @@ -220,7 +219,7 @@ \section{How to Make an Op (Python)} \begin{frame}{Tests} To test the gradient we use \code{verify_grad} -\lstinputlisting[linerange={5-5,33-41}]{test_doubleop.py} +\lstinputlisting[linerange={5-5,36-44}]{test_doubleop.py} It will compute the gradient numerically and symbolically (using our \code{grad()} method) and compare the two. \end{frame} diff --git a/test_doubleop.py b/test_doubleop.py index a36d16c..7b83919 100644 --- a/test_doubleop.py +++ b/test_doubleop.py @@ -9,6 +9,7 @@ def test_doubleop(): + utt.seed_rng() x = matrix() f = function([x], DoubleOp()(x)) inp = numpy.asarray(numpy.random.rand(5, 4), @@ -19,6 +20,7 @@ def test_doubleop(): class test_Double(utt.InferShapeTester): def test_infer_shape(self): + utt.seed_rng() x = matrix() self._compile_and_check( # function inputs (symbolic) @@ -33,14 +35,10 @@ def test_infer_shape(self): def test_doubleop_grad(): + utt.seed_rng() utt.verify_grad( # Op instance DoubleOp(), # Numeric inputs [numpy.random.rand(5, 7, 2)] ) - - -class test_DoubleRop(RopLop_checker): - def test_double_rop(self): - self.check_rop_lop(DoubleOp()(self.x), self.in_shape)