def test_scalar(self):
"""
Should return 0 for all scalar
"""
x = scalar('x')
p = ptp(x)
f = theano.function([x], p)
y = numpy.asarray(rand() * 2000 - 1000, dtype=config.floatX)
result = f(y)
numpyResult = numpy.ptp(y)
self.assertTrue(numpy.array_equal(result, numpyResult))
评论列表
文章目录