提交 6cb30c0f authored 作者: amrithasuresh's avatar amrithasuresh

Updated numpy as np

上级 708568c2
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
...@@ -14,8 +14,8 @@ from theano import In ...@@ -14,8 +14,8 @@ from theano import In
# 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_inplace(unittest.TestCase): class test_inplace(unittest.TestCase):
...@@ -34,7 +34,7 @@ class test_inplace(unittest.TestCase): ...@@ -34,7 +34,7 @@ class test_inplace(unittest.TestCase):
y = rand_ranged_matrix(-1000, 1000, [100, 101]) y = rand_ranged_matrix(-1000, 1000, [100, 101])
self.assertTrue(numpy.array_equal(f([x, y]), [y, x])) self.assertTrue(np.array_equal(f([x, y]), [y, x]))
def test_append_inplace(self): def test_append_inplace(self):
mySymbolicMatricesList = TypedListType(T.TensorType( mySymbolicMatricesList = TypedListType(T.TensorType(
...@@ -52,7 +52,7 @@ class test_inplace(unittest.TestCase): ...@@ -52,7 +52,7 @@ class test_inplace(unittest.TestCase):
y = rand_ranged_matrix(-1000, 1000, [100, 101]) y = rand_ranged_matrix(-1000, 1000, [100, 101])
self.assertTrue(numpy.array_equal(f([x], y), [x, y])) self.assertTrue(np.array_equal(f([x], y), [x, y]))
def test_extend_inplace(self): def test_extend_inplace(self):
mySymbolicMatricesList1 = TypedListType(T.TensorType( mySymbolicMatricesList1 = TypedListType(T.TensorType(
...@@ -72,7 +72,7 @@ class test_inplace(unittest.TestCase): ...@@ -72,7 +72,7 @@ class test_inplace(unittest.TestCase):
y = rand_ranged_matrix(-1000, 1000, [100, 101]) y = rand_ranged_matrix(-1000, 1000, [100, 101])
self.assertTrue(numpy.array_equal(f([x], [y]), [x, y])) self.assertTrue(np.array_equal(f([x], [y]), [x, y]))
def test_insert_inplace(self): def test_insert_inplace(self):
mySymbolicMatricesList = TypedListType(T.TensorType( mySymbolicMatricesList = TypedListType(T.TensorType(
...@@ -92,7 +92,7 @@ class test_inplace(unittest.TestCase): ...@@ -92,7 +92,7 @@ class test_inplace(unittest.TestCase):
y = rand_ranged_matrix(-1000, 1000, [100, 101]) y = rand_ranged_matrix(-1000, 1000, [100, 101])
self.assertTrue(numpy.array_equal(f([x], numpy.asarray(1, self.assertTrue(np.array_equal(f([x], np.asarray(1,
dtype='int64'), y), [x, y])) dtype='int64'), y), [x, y]))
def test_remove_inplace(self): def test_remove_inplace(self):
...@@ -110,7 +110,7 @@ class test_inplace(unittest.TestCase): ...@@ -110,7 +110,7 @@ class test_inplace(unittest.TestCase):
y = rand_ranged_matrix(-1000, 1000, [100, 101]) y = rand_ranged_matrix(-1000, 1000, [100, 101])
self.assertTrue(numpy.array_equal(f([x, y], y), [x])) self.assertTrue(np.array_equal(f([x, y], y), [x]))
def test_constant_folding(): def test_constant_folding():
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论