提交 5bc79fb4 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Make sure min <= max in test_clip

上级 116ad0f3
...@@ -7167,8 +7167,11 @@ class TestTensorInstanceMethods(unittest.TestCase): ...@@ -7167,8 +7167,11 @@ class TestTensorInstanceMethods(unittest.TestCase):
def test_clip(self): def test_clip(self):
X, Y = self.vars X, Y = self.vars
x, y = self.vals x, y = self.vals
Z = X.clip(0.5 - Y, 0.5 + Y) # numpy.clip gives unexpected values when min > max,
z = x.clip(0.5 - y, 0.5 + y) # so we have to make sure that min <= max in that test,
# otherwise it randomly fails.
Z = X.clip(Y - 0.5, Y + 0.5)
z = x.clip(y - 0.5, y + 0.5)
assert_array_equal(Z.eval({X: x, Y: y}), z) assert_array_equal(Z.eval({X: x, Y: y}), z)
def test_dot(self): def test_dot(self):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论