提交 20b5333d authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Move get_vector_length TensorSharedVariable tests to test_sharedvar

上级 87002260
...@@ -955,11 +955,6 @@ def test_get_vector_length(): ...@@ -955,11 +955,6 @@ def test_get_vector_length():
x = as_tensor_variable((1, 2, 3)) x = as_tensor_variable((1, 2, 3))
assert 3 == get_vector_length(x) assert 3 == get_vector_length(x)
# Test `TensorSharedVariable`s
x = aesara.shared(np.array((2, 3, 4, 5)))
res = get_vector_length(x)
assert res == 4
# Test `Join`s # Test `Join`s
z = join(0, as_tensor_variable(1, ndim=1), as_tensor_variable(x.shape[0], ndim=1)) z = join(0, as_tensor_variable(1, ndim=1), as_tensor_variable(x.shape[0], ndim=1))
assert isinstance(z.owner.op, Join) assert isinstance(z.owner.op, Join)
......
...@@ -7,6 +7,7 @@ import aesara ...@@ -7,6 +7,7 @@ import aesara
import aesara.sparse import aesara.sparse
import aesara.tensor as aet import aesara.tensor as aet
from aesara.misc.may_share_memory import may_share_memory from aesara.misc.may_share_memory import may_share_memory
from aesara.tensor import get_vector_length
from aesara.tensor.basic import MakeVector from aesara.tensor.basic import MakeVector
from aesara.tensor.shape import Shape_i, specify_shape from aesara.tensor.shape import Shape_i, specify_shape
from tests import unittest_tools as utt from tests import unittest_tools as utt
...@@ -700,3 +701,8 @@ def test_scalar_shared_options(): ...@@ -700,3 +701,8 @@ def test_scalar_shared_options():
# Simple test to make sure we do not loose that fonctionality. # Simple test to make sure we do not loose that fonctionality.
aesara.shared(value=0.0, name="lk", borrow=True) aesara.shared(value=0.0, name="lk", borrow=True)
aesara.shared(value=np.float32(0.0), name="lk", borrow=True) aesara.shared(value=np.float32(0.0), name="lk", borrow=True)
def test_get_vector_length():
x = aesara.shared(np.array((2, 3, 4, 5)))
assert get_vector_length(x) == 4
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论