Skip to content

Commit

Permalink
fix: torch.Tensor.new frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam-Armstrong committed Sep 6, 2024
1 parent 35661d6 commit a354d82
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ivy/functional/frontends/torch/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1442,8 +1442,10 @@ def __iand__(self, other):
self.ivy_array = self.bitwise_and(other).ivy_array
return self

def new(self):
return torch_frontend.tensor([], dtype=self.dtype, device=self.device)
def new(self, *shape_list):
if isinstance(shape_list[0], (list, tuple)):
shape_list = shape_list[0]
return torch_frontend.zeros(shape_list, dtype=self.dtype, device=self.device)

def __array__(self, dtype=None):
if dtype is None:
Expand Down

0 comments on commit a354d82

Please sign in to comment.