More explicit

上级 05d37e14
......@@ -7,6 +7,7 @@ cutils_ext.cpp
html
*.o
pdf
pull.sh
*.pyc
*.so
*.sw?
......@@ -493,10 +493,7 @@ class _testCase_matinv(unittest.TestCase):
# Sum of squared errors
ssdiff = sum((diff**2.0))
# May be able to abbreviate this by assuming default parameter
# TODO: Test that default works
g_b = gradient.grad(ssdiff, b, astensor(numpy.ones(1),name='g_cost'))
#g_b = gradient.grad(ssdiff, b) # This should be the abbreviated version
g_b = gradient.grad(ssdiff, b)
# compilation to function
# [a,b] are the inputs, [ssdiff,g_b] are the outputs
......
......@@ -107,7 +107,7 @@ def _assert_same_shapes(x, *rest):
shape = x.shape
for other in rest:
if other.shape != shape:
raise ValueError(_assert_same_shapes.E_shape)
raise ValueError(_assert_same_shapes.E_shape, shape, other.shape)
_assert_same_shapes.E_shape = "The dimensions of the inputs do not match."
def _assert_tensor_scalar(x, a):
......@@ -470,7 +470,11 @@ subtensor = _constructor(Subtensor)
# Elemwise #
class AddElemwise(_Elemwise):
def impl(self, x, y):
_assert_same_shapes(x, y)
try:
_assert_same_shapes(x, y)
except Exception, e:
print '------ ERROR HERE'
raise
return x + y
def grad(self, (x, y), gz):
return gz, gz
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论