Skip to content

Commit

Permalink
Update cache files [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-dev-bot committed Aug 9, 2024
1 parent 3d71d1a commit 5ea88b3
Show file tree
Hide file tree
Showing 159 changed files with 2,536 additions and 2,926 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ def forward(self, input):
"""
return torch.nn.functional.batch_norm(
input,
(
self.running_mean
if not self.training or self.track_running_stats
else None
),
self.running_mean
if not self.training or self.track_running_stats
else None,
self.running_var if not self.training or self.track_running_stats else None,
self.weight,
self.bias,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import ivy.functional.frontends.torch as torch
import ivy.functional.frontends.torch.nn as nn

import numbers
import typing
import numbers

from .helpers import Translated_ones_
from .helpers import Translated_zeros_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import ivy.functional.frontends.torch.nn as nn

import typing
import operator
from itertools import chain
from collections import OrderedDict
import typing
from collections import abc as container_abcs
from collections import OrderedDict
from itertools import chain

from .helpers import Translated__addindent

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import ivy.functional.frontends.torch as torch
import ivy.functional.frontends.torch.nn as nn

import operator
import typing
import operator
from collections import OrderedDict
from typing import overload
from itertools import islice
from typing import overload


class Translated_Sequential(nn.Module):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ def forward(self, input):
"""
normalized, self.running_mean, self.running_var = ivy_batch_norm_frnt(
input,
(
self.running_mean
if not self.training or self.track_running_stats
else None
),
self.running_mean
if not self.training or self.track_running_stats
else None,
self.running_var if not self.training or self.track_running_stats else None,
self.weight,
self.bias,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from collections import OrderedDict
import threading

import numbers
import typing
import numbers

from .ivy__helpers import ivy_add_frnt_
from .ivy__helpers import ivy_empty_frnt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from collections import OrderedDict
import threading

import typing
import operator
from itertools import chain
import typing
from collections import abc as container_abcs
from itertools import chain

from .ivy__helpers import ivy__addindent
from .ivy__helpers import ivy_add_frnt_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from collections import OrderedDict
import threading

import operator
import typing
from typing import overload
import operator
from itertools import islice
from typing import overload

from .ivy__helpers import ivy_add_frnt_
from .ivy__helpers import ivy_split_frnt_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import TypeVar
from typing import Protocol
from typing import TypeVar

_T_co = TypeVar("_T_co", covariant=True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,9 @@ def tensorflow_default_bknd(
return (
x
if tensorflow_exists_bknd(x)
else default_val() if default_callable else default_val
else default_val()
if default_callable
else default_val
)


Expand Down Expand Up @@ -1027,27 +1029,21 @@ def tensorflow_nested_map_bknd(
to_ignore = to_ignore + (class_instance,)
tuple_check_fn = tensorflow_default_bknd(
_tuple_check_fn,
(
(lambda x_, t_: isinstance(x_, t_))
if include_derived["tuple"]
else lambda x_, t_: type(x_) is t_
),
(lambda x_, t_: isinstance(x_, t_))
if include_derived["tuple"]
else lambda x_, t_: type(x_) is t_,
)
list_check_fn = tensorflow_default_bknd(
_list_check_fn,
(
(lambda x_, t_: isinstance(x_, t_))
if include_derived["list"]
else lambda x_, t_: type(x_) is t_
),
(lambda x_, t_: isinstance(x_, t_))
if include_derived["list"]
else lambda x_, t_: type(x_) is t_,
)
dict_check_fn = tensorflow_default_bknd(
_dict_check_fn,
(
(lambda x_, t_: isinstance(x_, t_))
if include_derived["dict"]
else lambda x_, t_: type(x_) is t_
),
(lambda x_, t_: isinstance(x_, t_))
if include_derived["dict"]
else lambda x_, t_: type(x_) is t_,
)
if tuple_check_fn(x, tuple) and not isinstance(x, to_ignore):
ret_list = [
Expand Down Expand Up @@ -1475,7 +1471,9 @@ def tensorflow_where(
dtype = (
x1.dtype
if hasattr(x1, "dtype")
else x2.dtype if hasattr(x2, "dtype") else tensorflow_default_dtype_bknd()
else x2.dtype
if hasattr(x2, "dtype")
else tensorflow_default_dtype_bknd()
)
if not tensorflow_is_array_bknd(x1):
x1 = tensorflow_asarray(x1, dtype=dtype)
Expand Down Expand Up @@ -1887,7 +1885,9 @@ def tensorflow__parse_query_bknd(query, x_shape, scatter=False):
(
tensorflow_reshape_bknd_(arr, (-1,))
if len(arr.shape) > 1
else tensorflow_expand_dims(arr) if not len(arr.shape) else arr
else tensorflow_expand_dims(arr)
if not len(arr.shape)
else arr
)
for arr in array_queries
]
Expand Down Expand Up @@ -2082,11 +2082,9 @@ def is_native(x):

if tensorflow_nested_argwhere_bknd(
input,
lambda x: (
tensorflow_dtype(x) == "uint64"
if is_native(x)
else x > 9223372036854775807 and x != math.inf
),
lambda x: tensorflow_dtype(x) == "uint64"
if is_native(x)
else x > 9223372036854775807 and x != math.inf,
stop_after_n_found=1,
):
ret = tf.uint64
Expand Down Expand Up @@ -2320,7 +2318,9 @@ def tensorflow_multiply(
dtype = (
x1.dtype
if hasattr(x1, "dtype")
else x2.dtype if hasattr(x2, "dtype") else tensorflow_default_dtype_bknd()
else x2.dtype
if hasattr(x2, "dtype")
else tensorflow_default_dtype_bknd()
)
if not tensorflow_is_array_bknd(x1):
x1 = tensorflow_asarray(x1, dtype=dtype)
Expand Down Expand Up @@ -2480,11 +2480,9 @@ def tensorflow_scatter_nd(
dtype = tensorflow_promote_types_bknd(out.dtype, updates_dtype)
updates = tensorflow.cast(
updates,
(
tensorflow_as_native_dtype(dtype)
if tensorflow_exists_bknd(out)
else updates_dtype
),
tensorflow_as_native_dtype(dtype)
if tensorflow_exists_bknd(out)
else updates_dtype,
)
expected_shape = (
list(tensorflow.shape(indices)[:-1])
Expand Down Expand Up @@ -2848,21 +2846,17 @@ def tensorflow_default_int_dtype_bknd(
elif isinstance(input, (list, tuple, dict)):
if tensorflow_nested_argwhere_bknd(
input,
lambda x: (
tensorflow_dtype(x) == "uint64"
if tensorflow_is_array_bknd(x)
else x > 9223372036854775807 and x != math.inf
),
lambda x: tensorflow_dtype(x) == "uint64"
if tensorflow_is_array_bknd(x)
else x > 9223372036854775807 and x != math.inf,
stop_after_n_found=1,
):
ret = tf.uint64
elif tensorflow_nested_argwhere_bknd(
input,
lambda x: (
tensorflow_dtype(x) == "int64"
if tensorflow_is_array_bknd(x)
else x > 2147483647 and x != math.inf
),
lambda x: tensorflow_dtype(x) == "int64"
if tensorflow_is_array_bknd(x)
else x > 2147483647 and x != math.inf,
stop_after_n_found=1,
):
ret = tf.int64
Expand Down Expand Up @@ -3028,7 +3022,9 @@ def tensorflow_add(
dtype = (
x1.dtype
if hasattr(x1, "dtype")
else x2.dtype if hasattr(x2, "dtype") else tensorflow_default_dtype_bknd()
else x2.dtype
if hasattr(x2, "dtype")
else tensorflow_default_dtype_bknd()
)
if not tensorflow_is_array_bknd(x1):
x1 = tensorflow_asarray(x1, dtype=dtype)
Expand Down Expand Up @@ -3316,7 +3312,9 @@ def tensorflow_divide(
dtype = (
x1.dtype
if hasattr(x1, "dtype")
else x2.dtype if hasattr(x2, "dtype") else tensorflow_default_dtype_bknd()
else x2.dtype
if hasattr(x2, "dtype")
else tensorflow_default_dtype_bknd()
)
if not tensorflow_is_array_bknd(x1):
x1 = tensorflow_asarray(x1, dtype=dtype)
Expand Down Expand Up @@ -3376,7 +3374,9 @@ def tensorflow_minimum(
dtype = (
x1.dtype
if hasattr(x1, "dtype")
else x2.dtype if hasattr(x2, "dtype") else tensorflow_default_dtype_bknd()
else x2.dtype
if hasattr(x2, "dtype")
else tensorflow_default_dtype_bknd()
)
if not tensorflow_is_array_bknd(x1):
x1 = tensorflow_asarray(x1, dtype=dtype)
Expand Down Expand Up @@ -3453,7 +3453,9 @@ def tensorflow_greater_equal(
dtype = (
x1.dtype
if hasattr(x1, "dtype")
else x2.dtype if hasattr(x2, "dtype") else tensorflow_default_dtype_bknd()
else x2.dtype
if hasattr(x2, "dtype")
else tensorflow_default_dtype_bknd()
)
if not tensorflow_is_array_bknd(x1):
x1 = tensorflow_asarray(x1, dtype=dtype)
Expand Down
Loading

0 comments on commit 5ea88b3

Please sign in to comment.