Skip to content

Commit

Permalink
paddle.numel tensor instance function (ivy-llc#16614)
Browse files Browse the repository at this point in the history
  • Loading branch information
mobley-trent authored Aug 1, 2023
1 parent 5499bbf commit d20f522
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 541 deletions.
2 changes: 1 addition & 1 deletion ivy/functional/frontends/paddle/tensor/stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def numel(x, name=None):
length = len(x)
except (ValueError, TypeError):
length = 1 # if 0 dimensional tensor with 1 element
return ivy.array([prod if prod > 0 else ivy.array(length, dtype=ivy.int64)])
return ivy.array(prod if prod > 0 else ivy.array(length, dtype=ivy.int64))


@with_unsupported_dtypes({"2.4.2 and below": ("float16", "bfloat16")}, "paddle")
Expand Down
4 changes: 4 additions & 0 deletions ivy/functional/frontends/paddle/tensor/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ def acosh(self, name=None):
def ceil(self):
return paddle_frontend.ceil(self)

@with_unsupported_dtypes({"2.5.1 and below": ("complex", "int8")}, "paddle")
def numel(self):
return paddle_frontend.numel(self)

@with_unsupported_dtypes({"2.5.1 and below": ("float16",)}, "paddle")
def asinh(self, name=None):
return paddle_frontend.Tensor(ivy.asinh(self._ivy_array))
Expand Down
Loading

0 comments on commit d20f522

Please sign in to comment.