提交 d8df351b authored 作者: Pascal Lamblin's avatar Pascal Lamblin 提交者: jhelie

Add test

上级 5bed824d
...@@ -8386,6 +8386,19 @@ class T_Choose(utt.InferShapeTester): ...@@ -8386,6 +8386,19 @@ class T_Choose(utt.InferShapeTester):
n_c = np.choose(A, B, mode=m) n_c = np.choose(A, B, mode=m)
assert np.allclose(t_c, n_c) assert np.allclose(t_c, n_c)
def test_method(self):
a = tensor.vector(dtype='int32')
b = tensor.matrix(dtype='float32')
A = np.random.randint(0, 4, 4).astype('int32')
B = np.asarray(np.random.rand(4, 4), dtype='float32')
for m in self.modes:
f = function([a, b], a.choose(b, mode=m))
t_c = f(A, B)
n_c = A.choose(B, mode=m)
assert np.allclose(t_c, n_c)
def test_broadcasted(self): def test_broadcasted(self):
a = tensor.scalar(dtype='int32') a = tensor.scalar(dtype='int32')
b = tensor.matrix(dtype='float32') b = tensor.matrix(dtype='float32')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论