提交 5393ba06 authored 作者: Frederic Bastien's avatar Frederic Bastien

add a test case.

上级 b6746643
...@@ -2583,6 +2583,19 @@ class test_tensordot(unittest.TestCase): ...@@ -2583,6 +2583,19 @@ class test_tensordot(unittest.TestCase):
f3(aval,bval))) f3(aval,bval)))
utt.verify_grad(TensorDot(axes), [aval,bval]) utt.verify_grad(TensorDot(axes), [aval,bval])
def test_scalar0(self):
# test tensor-tensor
amat = matrix()
bmat = matrix()
axes = 0
aval = self.rand(4,5)
bval = self.rand(5,4)
c = tensordot(axes)(amat, bmat)
f3 = inplace_func([amat,bmat],c)
self.failUnless(numpy.all(numpy.tensordot(aval,bval,axes) == \
f3(aval,bval)))
utt.verify_grad(TensorDot(axes), [aval,bval])
def test_tensordot_grad(self): def test_tensordot_grad(self):
#We test it manually as we recreate the op in the make_node #We test it manually as we recreate the op in the make_node
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论