Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
array
  • Loading branch information
xadupre committed Oct 31, 2023
commit eecc6abaee19d16f0c6739313351edd319aed513
3 changes: 2 additions & 1 deletion onnx_array_api/array_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def wrap(*args: List[Any], **kwargs: Dict[str, Any]) -> Any:
else:
b = a
new_args.append(b)
return f(TEagerTensor, *new_args, **kwargs)
res = f(TEagerTensor, *new_args, **kwargs)
return res

wrap.__doc__ = f.__doc__
return wrap
Expand Down
12 changes: 8 additions & 4 deletions onnx_array_api/array_api/_onnx_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,14 @@ def asarray(
if all(map(lambda x: isinstance(x, bool), a)):
v = TEagerTensor(np.array(a, dtype=np.bool_))
elif all(map(lambda x: isinstance(x, int), a)):
if all(map(lambda x: x >= 0, a)):
v = TEagerTensor(np.array(a, dtype=np.uint64))
else:
v = TEagerTensor(np.array(a, dtype=np.int64))
try:
cvt = np.array(a, dtype=np.int64)
except OverflowError as e:
if all(map(lambda x: x >= 0, a)):
cvt = np.array(a, dtype=np.uint64)
else:
raise e
v = TEagerTensor(cvt)
else:
v = TEagerTensor(np.array(a))
elif isinstance(a, np.ndarray):
Expand Down