Repository: ivy-llc/ivy

Issue:
Missing Mandatory key-word arguments `on_device`, `dtype`, and `method_input_dtypes`
In few files, in some of the function calls, Mandatory key-word arguments are missing:
like in the following cases:

1. `on_device` is missing:
https://github.com/unifyai/ivy/blob/2d33dbb03bf6f095beae44504b6998da3f65625e/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py#L4016
2. `method_input_dtypes` is missing:
https://github.com/unifyai/ivy/blob/2d33dbb03bf6f095beae44504b6998da3f65625e/ivy_tests/test_ivy/test_frontends/test_numpy/test_ndarray/test_ndarray.py#L2701
3. `dtype` is missing in these 2 function calls:
https://github.com/unifyai/ivy/blob/2d33dbb03bf6f095beae44504b6998da3f65625e/ivy/functional/backends/torch/creation.py#L480
https://github.com/unifyai/ivy/blob/2d33dbb03bf6f095beae44504b6998da3f65625e/ivy/functional/backends/paddle/creation.py#L275

I think at all these places the missing key-word arguments are mandatory and they need to passed.


Discussion:

Resolving patch:
diff --git a/ivy/functional/backends/paddle/creation.py b/ivy/functional/backends/paddle/creation.py
--- a/ivy/functional/backends/paddle/creation.py
+++ b/ivy/functional/backends/paddle/creation.py
@@ -272,7 +272,10 @@ def _linspace_helper(start, stop, num, axis=None, *, dtype=None):
         sos_shape = stop_shape
         if num == 1:
             return (
-                paddle_backend.ones(stop_shape[:axis] + [1] + stop_shape[axis:]) * start
+                paddle_backend.ones(
+                    stop_shape[:axis] + [1] + stop_shape[axis:], dtype=dtype
+                )
+                * start
             )
         stop = stop.reshape((-1,))
         linspace_method = (
diff --git a/ivy/functional/backends/torch/creation.py b/ivy/functional/backends/torch/creation.py
--- a/ivy/functional/backends/torch/creation.py
+++ b/ivy/functional/backends/torch/creation.py
@@ -477,7 +477,7 @@ def ones_like_v_0p1p12_to_0p2p0(
             x[i] = 1
         return x
     for i in range(x.shape[0]):
-        x[i, :] = ones_like_v_0p1p12_to_0p2p0(x[i, :])
+        x[i, :] = ones_like_v_0p1p12_to_0p2p0(x[i, :], dtype=dtype)
     return x
 
 


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_numpy/test_ndarray/test_ndarray.py b/ivy_tests/test_ivy/test_frontends/test_numpy/test_ndarray/test_ndarray.py
--- a/ivy_tests/test_ivy/test_frontends/test_numpy/test_ndarray/test_ndarray.py
+++ b/ivy_tests/test_ivy/test_frontends/test_numpy/test_ndarray/test_ndarray.py
@@ -2703,6 +2703,7 @@ def test_numpy_instance_ilshift__(
         init_all_as_kwargs_np={
             "object": x[0],
         },
+        method_input_dtypes=input_dtypes,
         backend_to_test=backend_fw,
         method_all_as_kwargs_np={
             "value": x[1],
diff --git a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
--- a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
+++ b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
@@ -4019,6 +4019,7 @@ def test_torch_bernoulli(
     frontend_method_data,
     init_flags,
     method_flags,
+    on_device,
     backend_fw,
 ):
     input_dtype, x = dtype_and_x
@@ -4034,6 +4035,7 @@ def test_torch_bernoulli(
         init_flags=init_flags,
         method_flags=method_flags,
         frontend=frontend,
+        on_device=on_device,
     )