File tree 3 files changed +89
-1
lines changed
onnx/backend/test/case/node
3 files changed +89
-1
lines changed Original file line number Diff line number Diff line change @@ -21869,6 +21869,38 @@ expect(
21869
21869
</details>
21870
21870
21871
21871
21872
+ <details>
21873
+ <summary>empty_set</summary>
21874
+
21875
+ ```python
21876
+ shape = [2, 0, 4]
21877
+ keepdims = 1
21878
+ reduced_shape = [2, 1, 4]
21879
+
21880
+ node = onnx.helper.make_node(
21881
+ "ReduceMax",
21882
+ inputs=["data", "axes"],
21883
+ outputs=["reduced"],
21884
+ keepdims=keepdims,
21885
+ )
21886
+
21887
+ data = np.array([], dtype=np.float32).reshape(shape)
21888
+ axes = np.array([1], dtype=np.int64)
21889
+ one = np.array(np.ones(reduced_shape, dtype=np.float32))
21890
+ zero = np.array(np.zeros(reduced_shape, dtype=np.float32))
21891
+ reduced = -(one / zero) # -inf
21892
+
21893
+ expect(
21894
+ node,
21895
+ inputs=[data, axes],
21896
+ outputs=[reduced],
21897
+ name="test_reduce_min_empty_set",
21898
+ )
21899
+ ```
21900
+
21901
+ </details>
21902
+
21903
+
21872
21904
<details>
21873
21905
<summary>keepdims</summary>
21874
21906
Original file line number Diff line number Diff line change @@ -14574,7 +14574,7 @@ expect(
14574
14574
14575
14575
14576
14576
### ReduceMax
14577
- There are 5 test cases, listed as following:
14577
+ There are 6 test cases, listed as following:
14578
14578
<details>
14579
14579
<summary>bool_inputs</summary>
14580
14580
@@ -14693,6 +14693,36 @@ expect(
14693
14693
)
14694
14694
```
14695
14695
14696
+ </details>
14697
+ <details>
14698
+ <summary>empty_set</summary>
14699
+
14700
+ ```python
14701
+ shape = [2, 0, 4]
14702
+ keepdims = 1
14703
+ reduced_shape = [2, 1, 4]
14704
+
14705
+ node = onnx.helper.make_node(
14706
+ "ReduceMax",
14707
+ inputs=["data", "axes"],
14708
+ outputs=["reduced"],
14709
+ keepdims=keepdims,
14710
+ )
14711
+
14712
+ data = np.array([], dtype=np.float32).reshape(shape)
14713
+ axes = np.array([1], dtype=np.int64)
14714
+ one = np.array(np.ones(reduced_shape, dtype=np.float32))
14715
+ zero = np.array(np.zeros(reduced_shape, dtype=np.float32))
14716
+ reduced = -(one / zero) # -inf
14717
+
14718
+ expect(
14719
+ node,
14720
+ inputs=[data, axes],
14721
+ outputs=[reduced],
14722
+ name="test_reduce_min_empty_set",
14723
+ )
14724
+ ```
14725
+
14696
14726
</details>
14697
14727
<details>
14698
14728
<summary>keepdims</summary>
Original file line number Diff line number Diff line change @@ -202,3 +202,29 @@ def export_bool_inputs() -> None:
202
202
outputs = [reduced ],
203
203
name = "test_reduce_max_bool_inputs" ,
204
204
)
205
+
206
+ @staticmethod
207
+ def export_empty_set () -> None :
208
+ shape = [2 , 0 , 4 ]
209
+ keepdims = 1
210
+ reduced_shape = [2 , 1 , 4 ]
211
+
212
+ node = onnx .helper .make_node (
213
+ "ReduceMax" ,
214
+ inputs = ["data" , "axes" ],
215
+ outputs = ["reduced" ],
216
+ keepdims = keepdims ,
217
+ )
218
+
219
+ data = np .array ([], dtype = np .float32 ).reshape (shape )
220
+ axes = np .array ([1 ], dtype = np .int64 )
221
+ one = np .array (np .ones (reduced_shape , dtype = np .float32 ))
222
+ zero = np .array (np .zeros (reduced_shape , dtype = np .float32 ))
223
+ reduced = - (one / zero ) # -inf
224
+
225
+ expect (
226
+ node ,
227
+ inputs = [data , axes ],
228
+ outputs = [reduced ],
229
+ name = "test_reduce_min_empty_set" ,
230
+ )
You can’t perform that action at this time.
0 commit comments