mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-10 17:37:14 +00:00
Remove special casing of "None" as a dim_param (#1482)
* Remove special casing of "None" as a dim_param
This commit is contained in:
parent
a8e3ff47fd
commit
f052966972
2 changed files with 3 additions and 4 deletions
|
|
@ -59,8 +59,7 @@ static void RemoveInvalidValues(ONNX_NAMESPACE::TypeProto& type) {
|
|||
for (int i = 0, end = shape->dim_size(); i < end; ++i) {
|
||||
auto& dim = *shape->mutable_dim(i);
|
||||
if (dim.has_dim_param()) {
|
||||
auto dim_param = dim.dim_param();
|
||||
if (dim_param.empty() || dim_param == "None") {
|
||||
if (dim.dim_param().empty()) {
|
||||
dim.clear_dim_param();
|
||||
}
|
||||
} else if (dim.has_dim_value()) {
|
||||
|
|
|
|||
|
|
@ -114,12 +114,12 @@ class TestInferenceSession(unittest.TestCase):
|
|||
self.assertEqual(input_name, "X")
|
||||
input_shape = sess.get_inputs()[0].shape
|
||||
# Input X has an unknown dimension.
|
||||
self.assertEqual(input_shape, [None, 2])
|
||||
self.assertEqual(input_shape, ['None', 2])
|
||||
output_name = sess.get_outputs()[0].name
|
||||
self.assertEqual(output_name, "Y")
|
||||
output_shape = sess.get_outputs()[0].shape
|
||||
# Output X has an unknown dimension.
|
||||
self.assertEqual(output_shape, [None, 1])
|
||||
self.assertEqual(output_shape, ['None', 1])
|
||||
res = sess.run([output_name], {input_name: x})
|
||||
output_expected = np.array([[5.0], [11.0], [17.0]], dtype=np.float32)
|
||||
np.testing.assert_allclose(
|
||||
|
|
|
|||
Loading…
Reference in a new issue