def test_eq(self):
for dtype in self.dtypes:
l = numpy.asarray([0., -1., 1.], dtype=dtype)
r = numpy.asarray([0., 1., -1.], dtype=dtype)
for x, y, err in [
(self.shared(l.astype(dtype)),
self.shared(r.astype(dtype)), False),
(l, self.shared(r.astype(dtype)), True),
(tensor.constant(l), self.shared(r.astype(dtype)), False),
(self.shared(l.astype(dtype)), r, False),
(self.shared(l.astype(dtype)), tensor.constant(r), False),
]:
try:
fn = self.inplace_func([], eq(x, y))
v = fn()
self.assertTrue(numpy.all(v == (l == r)), (v, (l == r)))
except TypeError:
assert err
评论列表
文章目录