Skip to content

Commit db9ee29

Browse files
committed
fix bug
if dtype is float, then equal can't be used to check if values are close or not
1 parent 6148265 commit db9ee29

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/common.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
""" test common utilities."""
55

66
import argparse
7+
import numpy as np
78
import os
89
import sys
910
import unittest
@@ -280,6 +281,10 @@ def check_onnxruntime_incompatibility(op):
280281
def validate_const_node(node, expected_val):
281282
if node.is_const():
282283
node_val = node.get_tensor_value()
284+
if (isinstance(expected_val, list) and isinstance(expected_val[0], float)) \
285+
or isinstance(expected_val, float):
286+
np.testing.assert_allclose(expected_val, node_val)
287+
return True
283288
return node_val == expected_val
284289
return False
285290

0 commit comments

Comments
 (0)