Skip to content

Commit

Permalink
lintfixbot: Auto-commit fixed lint errors in codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-branch committed Jan 24, 2023
1 parent ecabace commit f6d7ec0
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 43 deletions.
5 changes: 3 additions & 2 deletions ivy/functional/backends/jax/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ def dev(


def to_device(
x: JaxArray, device: jaxlib.xla_extension.Device,
x: JaxArray,
device: jaxlib.xla_extension.Device,
/,
*,
stream: Optional[int] = None,
out: Optional[JaxArray] = None
out: Optional[JaxArray] = None,
):
if device is not None:
cur_dev = as_native_dev(dev(x))
Expand Down
5 changes: 3 additions & 2 deletions ivy/functional/backends/numpy/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ def _to_device(x: np.ndarray, device=None) -> np.ndarray:


def to_device(
x: np.ndarray, device: str,
x: np.ndarray,
device: str,
/,
*,
stream: Optional[Union[int, Any]] = None,
out: Optional[np.ndarray] = None
out: Optional[np.ndarray] = None,
) -> np.ndarray:
if device is not None:
device = as_native_dev(device)
Expand Down
4 changes: 2 additions & 2 deletions ivy/functional/backends/tensorflow/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def conv1d_transpose(
dilations: Optional[int] = 1,
out: Optional[Union[tf.Tensor, tf.Variable]] = None,
):
if ivy.dev(x) == 'cpu' and (
if ivy.dev(x) == "cpu" and (
(dilations > 1) if isinstance(dilations, int) else any(d > 1 for d in dilations)
):
raise ivy.exceptions.IvyException(
Expand Down Expand Up @@ -109,7 +109,7 @@ def conv2d_transpose(
dilations: Optional[Union[int, Tuple[int, int]]] = 1,
out: Optional[Union[tf.Tensor, tf.Variable]] = None,
):
if ivy.dev(x) == 'cpu' and (
if ivy.dev(x) == "cpu" and (
(dilations > 1) if isinstance(dilations, int) else any(d > 1 for d in dilations)
):
raise ivy.exceptions.IvyException(
Expand Down
5 changes: 3 additions & 2 deletions ivy/functional/backends/torch/data_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ def as_ivy_dtype(dtype_in: Union[torch.dtype, str, bool, int, float], /) -> ivy.


@with_unsupported_dtypes({"1.11.0 and below": ("uint16",)}, backend_version)
def as_native_dtype(dtype_in: Union[torch.dtype, str, bool, int, float],
/) -> torch.dtype:
def as_native_dtype(
dtype_in: Union[torch.dtype, str, bool, int, float], /
) -> torch.dtype:
if dtype_in is int:
return ivy.default_int_dtype(as_native=True)
if dtype_in is float:
Expand Down
4 changes: 2 additions & 2 deletions ivy/functional/frontends/jax/numpy/manipulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ def swapaxes(a, axis1, axis2):
@to_ivy_arrays_and_back
def atleast_3d(*arys):
return ivy.atleast_3d(*arys)


@to_ivy_arrays_and_back
def atleast_2d(*arys):
return ivy.atleast_2d(*arys)
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ def test_jax_numpy_atleast_3d(
on_device=on_device,
**arys,
)


# atleast_2d
@handle_frontend_test(
Expand All @@ -669,12 +669,12 @@ def test_jax_numpy_atleast_3d(
test_with_out=st.just(False),
)
def test_jax_numpy_atleast_2d(
*,
dtype_and_x,
on_device,
fn_tree,
frontend,
test_flags,
*,
dtype_and_x,
on_device,
fn_tree,
frontend,
test_flags,
):
input_dtype, arrays = dtype_and_x
arys = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ def test_numpy_normal(
fn_tree="numpy.random.poisson",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("float"),
shape=st.tuples(
st.integers(min_value=1, max_value=2)),
shape=st.tuples(st.integers(min_value=1, max_value=2)),
min_value=1,
max_value=100,
),
Expand All @@ -167,9 +166,10 @@ def test_numpy_poisson(
on_device=on_device,
lam=x[0],
test_values=False,
size=size)
size=size,
)



@handle_frontend_test(
fn_tree="numpy.random.geometric",
input_dtypes=helpers.get_dtypes("float"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2059,5 +2059,5 @@ def test_torch_hypot(
on_device=on_device,
atol=1e-2,
input=x[0],
other=x[1]
other=x[1],
)
23 changes: 11 additions & 12 deletions ivy_tests/test_ivy/test_functional/test_nn/test_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,16 +322,14 @@ def x_and_filters(
fc = draw(st.sampled_from(group_list)) if general else 1
strides = draw(
st.one_of(
st.integers(1, 3),
st.lists(st.integers(1, 3), min_size=dim, max_size=dim)
st.integers(1, 3), st.lists(st.integers(1, 3), min_size=dim, max_size=dim)
)
if dim > 1
else st.integers(1, 3)
)
dilations = draw(
st.one_of(
st.integers(1, 3),
st.lists(st.integers(1, 3), min_size=dim, max_size=dim)
st.integers(1, 3), st.lists(st.integers(1, 3), min_size=dim, max_size=dim)
)
if dim > 1
else st.integers(1, 3)
Expand Down Expand Up @@ -359,7 +357,7 @@ def x_and_filters(
full_strides[i],
filter_shape[i],
padding,
full_dilations[i]
full_dilations[i],
)
)
else:
Expand Down Expand Up @@ -415,7 +413,7 @@ def x_and_filters(
x_dilation = draw(
st.one_of(
st.integers(1, 3),
st.lists(st.integers(1, 3), min_size=dim, max_size=dim)
st.lists(st.integers(1, 3), min_size=dim, max_size=dim),
)
)
dilations = (dilations, x_dilation)
Expand All @@ -436,12 +434,13 @@ def x_and_filters(

def _assume_tf_dilation_gt_1(backend_fw, on_device, dilations):
if backend_fw.current_backend_str() == "tensorflow":
assume(not (
on_device == "cpu"
and (dilations > 1)
if isinstance(dilations, int)
else any(d > 1 for d in dilations)
))
assume(
not (
on_device == "cpu" and (dilations > 1)
if isinstance(dilations, int)
else any(d > 1 for d in dilations)
)
)


# conv1d
Expand Down
18 changes: 9 additions & 9 deletions requirement_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import operator
import requests
import sys

url = "https://pypi.python.org/pypi/"


Expand Down Expand Up @@ -108,21 +109,20 @@ def get_package_versions(lis: List):
return dict()
dic = dict()
for i in lis:
if ';' in i:
i=i[:i.index(';')]
if ";" in i:
i = i[: i.index(";")]
if " " in i:
dic[i.split(" ")[0]] = get_version_from_string(i.split(" ")[1])
else:
dic[i]=()

dic[i] = ()

return dic


def resolution(conflict_keys, dic1, dic2):
resolution = {}
for i in conflict_keys:
if dic1[i]==dic2[i]:
if dic1[i] == dic2[i]:
continue
for j in dic1[i]:
for k in dic2[i]:
Expand Down Expand Up @@ -159,12 +159,14 @@ def package_conflicts(pkg1, pkg2=None):
def get_package_requirements(pkg):
return requests.get(url + str(pkg) + "/json").json()


def tuple_to_version(tup):
s=''
s = ""
for i in tup:
s+=str(i)+'.'
s += str(i) + "."
return s[:-1]


# example usage
# if __name__ == "__main__":
# fw1=sys.argv[1]
Expand Down Expand Up @@ -192,8 +194,6 @@ def tuple_to_version(tup):
# f.write(f"{key}=={val}")




print(package_conflicts("h5py/3.7.0", "h5py/3.7.0"))
# #
# # print(get_package_requirements('tensorflow/2.2.0')["info"]["requires_dist"])
Expand Down

0 comments on commit f6d7ec0

Please sign in to comment.