提交 68f4e259 authored 作者: amrithasuresh's avatar amrithasuresh

Updated numpy as np

上级 6cb30c0f
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
import unittest import unittest
import numpy import numpy as np
import theano import theano
import theano.typed_list import theano.typed_list
...@@ -12,8 +12,8 @@ from theano.tests import unittest_tools as utt ...@@ -12,8 +12,8 @@ from theano.tests import unittest_tools as utt
# took from tensors/tests/test_basic.py # took from tensors/tests/test_basic.py
def rand_ranged_matrix(minimum, maximum, shape): def rand_ranged_matrix(minimum, maximum, shape):
return numpy.asarray(numpy.random.rand(*shape) * (maximum - minimum) + return np.asarray(np.random.rand(*shape) * (maximum - minimum) +
minimum, dtype=theano.config.floatX) minimum, dtype=theano.config.floatX)
class test_typed_list_type(unittest.TestCase): class test_typed_list_type(unittest.TestCase):
...@@ -84,7 +84,7 @@ class test_typed_list_type(unittest.TestCase): ...@@ -84,7 +84,7 @@ class test_typed_list_type(unittest.TestCase):
x = rand_ranged_matrix(-1000, 1000, [100, 100]) x = rand_ranged_matrix(-1000, 1000, [100, 100])
self.assertTrue(numpy.array_equal(myType.filter([x]), [x])) self.assertTrue(np.array_equal(myType.filter([x]), [x]))
def test_intern_filter(self): def test_intern_filter(self):
""" """
...@@ -95,9 +95,9 @@ class test_typed_list_type(unittest.TestCase): ...@@ -95,9 +95,9 @@ class test_typed_list_type(unittest.TestCase):
myType = TypedListType(T.TensorType('float64', myType = TypedListType(T.TensorType('float64',
(False, False))) (False, False)))
x = numpy.asarray([[4, 5], [4, 5]], dtype='float32') x = np.asarray([[4, 5], [4, 5]], dtype='float32')
self.assertTrue(numpy.array_equal(myType.filter([x]), [x])) self.assertTrue(np.array_equal(myType.filter([x]), [x]))
# Will fail for unknown reasons # Will fail for unknown reasons
# under search # under search
...@@ -125,7 +125,7 @@ class test_typed_list_type(unittest.TestCase): ...@@ -125,7 +125,7 @@ class test_typed_list_type(unittest.TestCase):
x = rand_ranged_matrix(-1000, 1000, [100, 100]) x = rand_ranged_matrix(-1000, 1000, [100, 100])
self.assertTrue(numpy.array_equal(myType.filter([[x]]), [[x]])) self.assertTrue(np.array_equal(myType.filter([[x]]), [[x]]))
def test_comparison_different_depth(self): def test_comparison_different_depth(self):
""" """
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论