def test_dtype_cache(self):
"""Checks that the same Op is returned on repeated calls to arange
using the same dtype, but not for different dtypes."""
start, stop, step = iscalars('start', 'stop', 'step')
out1 = arange(start, stop, step)
out2 = arange(start, stop, step, dtype=out1.dtype)
out3 = arange(start, stop, 2., dtype=out1.dtype)
out4 = arange(start, stop, 2.)
assert out1.owner.op is out2.owner.op
assert out2.owner.op is out3.owner.op
assert out3.owner.op is not out4.owner.op
评论列表
文章目录