Skip to content

Extends Array API to EagerOrt #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 13, 2023
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
fix empty shape
  • Loading branch information
xadupre committed Jun 12, 2023
commit 0e73dda56c7b650e17252483f671dddadc1fb66e
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ _cache/*
dist/*
build/*
.eggs/*
.hypothesis/*
*egg-info/*
_doc/auto_examples/*
_doc/examples/_cache/*
Expand Down
2 changes: 1 addition & 1 deletion onnx_array_api/npx/npx_graph_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def _io(
self, index: int, name: str, tensor_type: Optional[type], is_input: bool
) -> ValueInfoProto:
"""
Converts an input or outut into :class:`onnx.ValueInfoProto`.
Converts an input or output into :class:`onnx.ValueInfoProto`.

:param index: index of the input or output to add
:param name: input or output name
Expand Down
9 changes: 4 additions & 5 deletions onnx_array_api/npx/npx_numpy_tensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,12 @@ def dims(self):
"""
Returns the dimensions of the tensor.
First dimension is the batch dimension if the tensor
has more than one dimension.
has more than one dimension. It is always left undefined.
"""
if len(self._tensor.shape) == 0:
return (0,)
if len(self._tensor.shape) == 1:
if len(self._tensor.shape) <= 1:
# a scalar (len==0) or a 1D tensor
return self._tensor.shape
return (None,) + self._tensor.shape[1:]
return (None, *tuple(self.shape[1:]))

@property
def ndim(self):
Expand Down
2 changes: 1 addition & 1 deletion onnx_array_api/npx/npx_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ def __getitem__(self, index: Any) -> "Var":
cst, var = Var.get_cst_var()

if self.n_var_outputs != 1:
# Multioutut
# Multioutput
if not isinstance(index, int):
raise TypeError(
f"Only indices are allowed when selecting an output, "
Expand Down
9 changes: 4 additions & 5 deletions onnx_array_api/ort/ort_tensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,11 @@ def dims(self):
"""
Returns the dimensions of the tensor.
First dimension is the batch dimension if the tensor
has more than one dimension.
has more than one dimension. It is always left undefined.
"""
if len(self.shape) == 0:
return (0,)
if len(self.shape) == 1:
return tuple(self.shape)
if len(self._tensor.shape) <= 1:
# a scalar (len==0) or a 1D tensor
return self._tensor.shape
return (None, *tuple(self.shape[1:]))

@property
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy