Skip to content

[IR] Use shape.freeze() #2247

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 1 commit into from
Apr 29, 2025
Merged
Changes from all commits
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
6 changes: 3 additions & 3 deletions onnxscript/ir/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def __init__(
self._shape = Shape(getattr(value, "shape"), frozen=True) # noqa: B009
else:
self._shape = shape
self._shape._frozen = True
self._shape.freeze()
if dtype is None:
if isinstance(value, np.ndarray):
self._dtype = _enums.DataType.from_numpy(value.dtype)
Expand Down Expand Up @@ -564,7 +564,7 @@ def __init__(
self._dtype: _enums.DataType = dtype
self.name: str = name # mutable
self._shape: Shape = shape
self._shape._frozen = True
self._shape.freeze()
self.doc_string: str | None = doc_string # mutable
self._array: np.ndarray | None = None
self.raw: mmap.mmap | None = None
Expand Down Expand Up @@ -783,7 +783,7 @@ def __init__(
self._shape = Shape(getattr(value, "shape"), frozen=True) # noqa: B009
else:
self._shape = shape
self._shape._frozen = True
self._shape.freeze()
self._raw = value
self.name = name
self.doc_string = doc_string
Expand Down
Loading