From f28edd9dbba61d9c0cb745ef56ff0d05f4f561f1 Mon Sep 17 00:00:00 2001 From: Suyash Gupta Date: Thu, 25 Jan 2024 17:08:00 +0530 Subject: [PATCH] fix: Fix Ivy Failing Test: numpy - manipulation.swapaxes --- ivy/functional/backends/numpy/manipulation.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ivy/functional/backends/numpy/manipulation.py b/ivy/functional/backends/numpy/manipulation.py index 23303b6fbba8e..19023b3a23ab9 100644 --- a/ivy/functional/backends/numpy/manipulation.py +++ b/ivy/functional/backends/numpy/manipulation.py @@ -1,12 +1,14 @@ # global import math from numbers import Number -from typing import Union, Tuple, Optional, List, Sequence +from typing import List, Optional, Sequence, Tuple, Union + import numpy as np # local import ivy from ivy.func_wrapper import with_unsupported_dtypes + from . import backend_version @@ -233,6 +235,8 @@ def swapaxes( copy: Optional[bool] = None, out: Optional[np.ndarray] = None, ) -> np.ndarray: + if copy: + x = x.copy() return np.swapaxes(x, axis0, axis1)