@@ -81,6 +81,10 @@ def to(self, tensor_like) -> "OnnxList":
8181 ]
8282 )
8383
84+ def clone (self ) -> "OnnxList" :
85+ "Clone (torch)."
86+ return [t .clone () for t in self ]
87+
8488
8589class OnnxruntimeEvaluator :
8690 """
@@ -708,6 +712,10 @@ def _run(self, node: NodeProto, inputs: List[Any], results: Dict[str, Any]) -> L
708712
709713 outputs = list (sess .run (None , feeds ))
710714 assert isinstance (outputs , list ), f"Unexpected type for outputs { type (outputs )} "
715+ assert not any (type (v ) is list for v in outputs ), (
716+ f"One output type is a list, this should not be allowed, "
717+ f"node.op_type={ node .op_type } , feeds={ string_type (feeds ,with_shape_type = True )} "
718+ )
711719 return outputs
712720
713721 def _run_if (
@@ -783,6 +791,11 @@ def _run_scan_or_loop(
783791 self , node : NodeProto , inputs : List [Any ], results : Dict [str , Any ]
784792 ) -> List [Any ]:
785793 """Runs a node Scan."""
794+ assert not any (type (i ) is list for i in inputs ), (
795+ f"One input is a list but it should an OnnxList, "
796+ f"node.op_type={ node .op_type !r} , node.input={ node .input } , "
797+ f"inputs={ string_type (inputs , with_shape = True )} "
798+ )
786799 feeds = dict (zip (node .input , inputs ))
787800 feeds .update (results )
788801 name = "body"
0 commit comments