Repository: microsoft/onnxscript

Issue:
Fix type annotation issue of Sequence and fix a list issue in eager mode.
1. While calling pytepe_to_attrtype() function, the annotation of typing.Sequence will be identified to collections.abc.Sequence by get_origin(). This will impact the further execution, so adding collections.abc.Sequence into the _LIST_CONSTRUCTORS.
2. While calling a function in eager mode, a list type of input should not be transformed to be a Tensor list. Update the code logic accordingly.


Discussion:
# [Codecov](https://codecov.io/gh/microsoft/onnx-script/pull/267?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) Report
> Merging [#267](https://codecov.io/gh/microsoft/onnx-script/pull/267?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) (97209a7) into [main](https://codecov.io/gh/microsoft/onnx-script/commit/040c81194575b20fdd7c6309b4b56120bb21d42c?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) (040c811) will **increase** coverage by `0.00%`.
> The diff coverage is `66.66%`.

```diff
@@           Coverage Diff           @@
##             main     #267   +/-   ##
=======================================
  Coverage   72.68%   72.68%           
=======================================
  Files          95       95           
  Lines        9054     9055    +1     
=======================================
+ Hits         6581     6582    +1     
  Misses       2473     2473           
```


| [Impacted Files](https://codecov.io/gh/microsoft/onnx-script/pull/267?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | Coverage Δ | |
|---|---|---|
| [onnxscript/values.py](https://codecov.io/gh/microsoft/onnx-script/pull/267/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft#diff-b25ueHNjcmlwdC92YWx1ZXMucHk=) | `87.42% <0.00%> (ø)` | |
| [onnxscript/type\_annotation.py](https://codecov.io/gh/microsoft/onnx-script/pull/267/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft#diff-b25ueHNjcmlwdC90eXBlX2Fubm90YXRpb24ucHk=) | `94.28% <100.00%> (+0.16%)` | :arrow_up: |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft)


Resolving patch:
diff --git a/onnxscript/type_annotation.py b/onnxscript/type_annotation.py
--- a/onnxscript/type_annotation.py
+++ b/onnxscript/type_annotation.py
@@ -25,7 +25,7 @@
     str: onnx.AttributeProto.STRINGS,
 }
 
-_LIST_CONSTRUCTORS = [list, typing.List, typing.Sequence, collections.abc.Sequence]
+_LIST_CONSTRUCTORS = frozenset([list, typing.List, typing.Sequence, collections.abc.Sequence])
 
 
 def pytype_to_attrtype(pytype: type) -> typing.Optional[onnx.AttributeProto.AttributeType]:
diff --git a/onnxscript/values.py b/onnxscript/values.py
--- a/onnxscript/values.py
+++ b/onnxscript/values.py
@@ -207,7 +207,7 @@ def adapt(input: ExtendedModeValue) -> EagerModeValue:
         elif input is None:
             return None
         elif isinstance(input, list):
-            return input
+            return [adapt(elt) for elt in input]
         elif isinstance(input, tuple):
             return tuple(adapt(elt) for elt in input)
         raise TypeError(f"Unexpected input type {type(input)}.")


Test patch: