Skip to content

Commit

Permalink
#4003: use if-else instead of try-except in ttnn.reshape and ttnn.per…
Browse files Browse the repository at this point in the history
…mute
  • Loading branch information
arakhmati committed Dec 7, 2023
1 parent a18444f commit 44443f0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ttnn/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,10 +1009,10 @@ def ttnn_reshape(ttl_input_tensor, shape):
ttl_input_tensor, shape
)

try:
if len(input_tensor.shape) == 4 and len(shape) == 4:
w, z, y, x = shape
return Tensor(ttl.tensor.reshape(ttl_input_tensor, w, z, y, x))
except:
else:

def torch_reshape(tensor, shape):
return tensor.reshape(shape).contiguous()
Expand Down Expand Up @@ -1063,9 +1063,9 @@ def permute(input_tensor: Tensor, order: Tuple[int, ...]) -> Tensor:

ttl_input_tensor = input_tensor._tensor

try:
if len(ttl_input_tensor.shape) == 4:
return Tensor(ttl.tensor.permute(ttl_input_tensor, order))
except:
else:

def torch_permute(tensor, order):
return tensor.permute(order).contiguous()
Expand Down

0 comments on commit 44443f0

Please sign in to comment.