Skip to content
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

fix: fixing the tests for ivy.Shape method #28470

Merged
merged 6 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
40 changes: 2 additions & 38 deletions ivy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,23 +304,10 @@ def __rmul__(self, other):
return self

def __bool__(self):
if ivy.current_backend_str() == "tensorflow":
return builtins.bool(builtins.tuple(self._shape))
return builtins.bool(self._shape)

def __div__(self, other):
return self._shape // other

def __floordiv__(self, other):
return self._shape // other

def __mod__(self, other):
return self._shape % other

def __rdiv__(self, other):
return other // self._shape

def __rmod__(self, other):
return other % self._shape

def __reduce__(self):
return (self.__class__, (self._shape,))

Expand All @@ -330,33 +317,10 @@ def as_dimension(self, other):
else:
return self._shape

def __sub__(self, other):
try:
self._shape = self._shape - other
except TypeError:
self._shape = self._shape - list(other)
return self

def __rsub__(self, other):
try:
self._shape = other - self._shape
except TypeError:
self._shape = list(other) - self._shape
return self

def __eq__(self, other):
self._shape = Shape._shape_casting_helper(self._shape, other)
return self._shape == other

def __int__(self):
if hasattr(self._shape, "__int__"):
res = self._shape.__int__()
else:
res = int(self._shape)
if res is NotImplemented:
return res
return to_ivy(res)

def __ge__(self, other):
self._shape = Shape._shape_casting_helper(self._shape, other)
return self._shape >= other
Expand Down
Loading
Loading