def test_neibs_bad_shape(self):
shape = (2, 3, 10, 10)
for dtype in self.dtypes:
images = shared(numpy.arange(
numpy.prod(shape), dtype=dtype
).reshape(shape))
for neib_shape in [(3, 2), (2, 3)]:
neib_shape = T.as_tensor_variable(neib_shape)
f = function([], images2neibs(images, neib_shape),
mode=self.mode)
self.assertRaises(TypeError, f)
# Test that ignore border work in that case.
f = function([],
images2neibs(images, neib_shape,
mode='ignore_borders'),
mode=self.mode)
assert self.op in [type(node.op)
for node in f.maker.fgraph.toposort()]
f()
评论列表
文章目录