提交 09e32867 authored 作者: Frederic's avatar Frederic

Add docstring per code review.

上级 4a7b9c4b
...@@ -2370,6 +2370,9 @@ class SpecifyShape(Op): ...@@ -2370,6 +2370,9 @@ class SpecifyShape(Op):
def c_code(self, node, nodename, inp, out, sub): def c_code(self, node, nodename, inp, out, sub):
if not isinstance(node.inputs[0], TensorVariable): if not isinstance(node.inputs[0], TensorVariable):
# The c code bellow support only Tensor. super.c_code
# will raise an exception to tell that there isn't c code
# for the other cases.
return super(SpecifyShape, self).c_code(node, nodename, return super(SpecifyShape, self).c_code(node, nodename,
inp, out, sub) inp, out, sub)
iname, shape = inp iname, shape = inp
......
...@@ -6327,7 +6327,12 @@ def test_transpose(): ...@@ -6327,7 +6327,12 @@ def test_transpose():
class TestSpecifyShape(unittest.TestCase): class TestSpecifyShape(unittest.TestCase):
def shortDescription(self):
return None
def test_bad_shape(self): def test_bad_shape(self):
""" Test that at run time we raise an exception when the shape
is not the one specified"""
specify_shape = SpecifyShape() specify_shape = SpecifyShape()
x = vector() x = vector()
...@@ -6346,6 +6351,7 @@ class TestSpecifyShape(unittest.TestCase): ...@@ -6346,6 +6351,7 @@ class TestSpecifyShape(unittest.TestCase):
self.assertRaises(AssertionError, f, xval) self.assertRaises(AssertionError, f, xval)
def test_bad_number_of_shape(self): def test_bad_number_of_shape(self):
""" Test that the number of dimensions provided is good"""
specify_shape = SpecifyShape() specify_shape = SpecifyShape()
x = vector() x = vector()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论