@@ -16,7 +16,14 @@ def match(self) -> bool:
1616 if self .dyn_dim_cstrs is None :
1717 return False
1818 sym_shapes_str = self .dyn_dim_cstrs .serialize_symbolic_input_shapes_to_str ()
19- return sym_shapes_str in self ._get_map_cv_sym_shapes_str2reifier ()
19+ if sym_shapes_str == "[]" :
20+ return False
21+ elif sym_shapes_str not in self ._get_map_cv_sym_shapes_str2reifier ():
22+ print (
23+ f"[CV SymDim Reify] No reifier matched symbolic shapes:{ sym_shapes_str } \n Please add a reify rule to _get_map_cv_sym_shapes_str2reifier()"
24+ )
25+ return False
26+ return True
2027
2128 def reify (self ):
2229 assert self .match ()
@@ -40,6 +47,15 @@ def _get_map_cv_sym_shapes_str2reifier(cls):
4047 "[(S0,80,S1),(S0,)]" : cls .reify_nemo_asr_s0_s1 ,
4148 "[(S0,3,512,1024)]" : cls .reify_semantic_seg_s0 ,
4249 "[(S0,3,640,640)]" : cls .reify_yolo_s0 ,
50+ "[(S0,)]" : cls .reify_s0 ,
51+ "[(S0,S1,S2)]" : cls .reify_s0_s1_s2 ,
52+ "[(S0,S1,S2,S2)]" : cls .reify_s0_s1_s2 ,
53+ "[(S0,3,S1,S2,S2)]" : cls .reify_s0_s1_s2 ,
54+ "[(S0,S1,S1,384)]" : cls .reify_s0_s1_384 ,
55+ "[(S0,S1),(S0,S1,2560)]" : cls .reify_s0_s1_2560 ,
56+ "[(S0,S1,256),(S0,S1,256)]" : cls .reify_s0_s1_256 ,
57+ "[(S0,S1),(S0,S1,3072)]" : cls .reify_s0_s1_128_1024 ,
58+ "[(S0,S1),(S0,S1,1024),(S0,S1,1024)]" : cls .reify_s0_s1_128_1024 ,
4359 }
4460 return cls .g_cv_sym_shapes_str2reifier
4561
@@ -184,3 +200,89 @@ def reify_yolo_s0(self):
184200 return {
185201 S0 : [[1 ], [2 ], [4 ], [8 ], [12 ], [16 ], [24 ], [32 ], [64 ]],
186202 }
203+
204+ def reify_s0 (self ):
205+ S0 = (sympy .Symbol ("S0" ),)
206+ return {
207+ S0 : [[1 ], [2 ], [4 ], [8 ], [16 ], [32 ], [48 ], [64 ], [128 ]],
208+ }
209+
210+ def reify_s0_s1_s2 (self ):
211+ S0S1S2 = (sympy .Symbol ("S0" ), sympy .Symbol ("S1" ), sympy .Symbol ("S2" ))
212+ return {
213+ S0S1S2 : [
214+ [1 , 8 , 8 ],
215+ [1 , 8 , 16 ],
216+ [1 , 16 , 16 ],
217+ [2 , 16 , 16 ],
218+ [1 , 16 , 32 ],
219+ [2 , 16 , 32 ],
220+ [4 , 16 , 32 ],
221+ [1 , 32 , 32 ],
222+ [2 , 32 , 32 ],
223+ ],
224+ }
225+
226+ def reify_s0_s1_384 (self ):
227+ S0S1 = (sympy .Symbol ("S0" ), sympy .Symbol ("S1" ))
228+ return {
229+ S0S1 : [
230+ [1 , 64 ],
231+ [1 , 128 ],
232+ [1 , 192 ],
233+ [1 , 224 ],
234+ [1 , 256 ],
235+ [4 , 224 ],
236+ [8 , 224 ],
237+ [32 , 224 ],
238+ [64 , 224 ],
239+ ],
240+ }
241+
242+ def reify_s0_s1_2560 (self ):
243+ S0S1 = (sympy .Symbol ("S0" ), sympy .Symbol ("S1" ))
244+ return {
245+ S0S1 : [
246+ [1 , 16 ],
247+ [1 , 32 ],
248+ [2 , 32 ],
249+ [1 , 64 ],
250+ [2 , 64 ],
251+ [1 , 128 ],
252+ [2 , 128 ],
253+ [1 , 256 ],
254+ [2 , 256 ],
255+ ],
256+ }
257+
258+ def reify_s0_s1_256 (self ):
259+ S0S1 = (sympy .Symbol ("S0" ), sympy .Symbol ("S1" ))
260+ return {
261+ S0S1 : [
262+ [1 , 8 ],
263+ [1 , 16 ],
264+ [2 , 16 ],
265+ [1 , 32 ],
266+ [2 , 32 ],
267+ [4 , 32 ],
268+ [1 , 64 ],
269+ [2 , 64 ],
270+ [4 , 64 ],
271+ ],
272+ }
273+
274+ def reify_s0_s1_128_1024 (self ):
275+ S0S1 = (sympy .Symbol ("S0" ), sympy .Symbol ("S1" ))
276+ return {
277+ S0S1 : [
278+ [1 , 8 ],
279+ [1 , 16 ],
280+ [2 , 16 ],
281+ [1 , 32 ],
282+ [2 , 32 ],
283+ [4 , 32 ],
284+ [1 , 64 ],
285+ [2 , 64 ],
286+ [4 , 64 ],
287+ ],
288+ }
0 commit comments