Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d8aca13
Bump the black version. Fixes the ci.
gabrieldemarmiesse Aug 28, 2020
d0c3d18
Removed trailing commas.
gabrieldemarmiesse Aug 28, 2020
967c701
Update tensorflow_addons/image/filters.py
gabrieldemarmiesse Aug 28, 2020
523b357
Update tensorflow_addons/image/cutout_ops.py
gabrieldemarmiesse Aug 28, 2020
62c3ad6
Removed trailing commas.
gabrieldemarmiesse Aug 28, 2020
77830ab
Removed commas.
gabrieldemarmiesse Aug 28, 2020
83c0abf
Removed some more commas.
gabrieldemarmiesse Aug 28, 2020
1d20dda
Removed some commas.
gabrieldemarmiesse Aug 28, 2020
5df654e
Removed some commas.
gabrieldemarmiesse Aug 28, 2020
5bb8e7b
Update tensorflow_addons/optimizers/moving_average.py
gabrieldemarmiesse Aug 28, 2020
f4af227
Update tensorflow_addons/losses/tests/kappa_loss_test.py
gabrieldemarmiesse Aug 28, 2020
d284c83
Update tensorflow_addons/layers/tests/wrappers_test.py
gabrieldemarmiesse Aug 28, 2020
fe70be5
Update tensorflow_addons/layers/tests/wrappers_test.py
gabrieldemarmiesse Aug 28, 2020
eb670f6
Update tensorflow_addons/layers/tests/wrappers_test.py
gabrieldemarmiesse Aug 28, 2020
f319f8c
Update tensorflow_addons/layers/tests/spectral_normalization_test.py
gabrieldemarmiesse Aug 28, 2020
c3ce210
Update tensorflow_addons/layers/tests/spectral_normalization_test.py
gabrieldemarmiesse Aug 28, 2020
628e001
Update tensorflow_addons/losses/tests/triplet_test.py
gabrieldemarmiesse Aug 28, 2020
544c67b
Update tensorflow_addons/metrics/tests/hamming_test.py
gabrieldemarmiesse Aug 28, 2020
a8dfbea
Update tensorflow_addons/metrics/tests/multilabel_confusion_matrix_te…
gabrieldemarmiesse Aug 28, 2020
c2c351e
Update tensorflow_addons/optimizers/lookahead.py
gabrieldemarmiesse Aug 28, 2020
a9551ae
Update tensorflow_addons/metrics/tests/multilabel_confusion_matrix_te…
gabrieldemarmiesse Aug 28, 2020
aa6d06c
Update tensorflow_addons/metrics/r_square.py
gabrieldemarmiesse Aug 28, 2020
9f73428
Removed commas.
gabrieldemarmiesse Aug 28, 2020
5729af7
Removed commas.
gabrieldemarmiesse Aug 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions build_deps/toolchains/gpu/find_cuda_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,16 @@ def get_nvcc_version(path):

nvcc_name = "nvcc.exe" if _is_windows() else "nvcc"
nvcc_path, nvcc_version = _find_versioned_file(
base_paths, ["", "bin",], nvcc_name, cuda_version, get_nvcc_version
base_paths,
["", "bin"],
nvcc_name,
cuda_version,
get_nvcc_version,
)

nvvm_path = _find_file(
base_paths,
["nvvm/libdevice", "share/cuda", "lib/nvidia-cuda-toolkit/libdevice",],
["nvvm/libdevice", "share/cuda", "lib/nvidia-cuda-toolkit/libdevice"],
"libdevice*.10.bc",
)

Expand Down
4 changes: 2 additions & 2 deletions tensorflow_addons/activations/tests/sparsemax_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_sparsemax_against_numpy_high_rank(dtype):
def test_sparsemax_of_nan(dtype):
"""check sparsemax transfers nan."""
z_nan = np.asarray(
[[0, np.nan, 0], [0, np.nan, np.nan], [np.nan, np.nan, np.nan],]
[[0, np.nan, 0], [0, np.nan, np.nan], [np.nan, np.nan, np.nan]]
).astype(dtype)

tf_sparsemax_nan = sparsemax(z_nan)
Expand All @@ -132,7 +132,7 @@ def test_sparsemax_of_nan(dtype):
def test_sparsemax_of_inf(dtype):
"""check sparsemax is infinity safe."""
z_neg = np.asarray(
[[0, -np.inf, 0], [0, -np.inf, -np.inf], [-np.inf, -np.inf, -np.inf],]
[[0, -np.inf, 0], [0, -np.inf, -np.inf], [-np.inf, -np.inf, -np.inf]]
).astype(dtype)
z_pos = np.asarray(
[[0, np.inf, 0], [0, np.inf, np.inf], [np.inf, np.inf, np.inf]]
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_addons/image/compose_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def blend(image1: TensorLike, image2: TensorLike, factor: Number) -> tf.Tensor:
Returns:
A blended image Tensor of `tf.float32`.

"""
"""
with tf.name_scope("blend"):

if factor == 0.0:
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_addons/image/cutout_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def random_cutout(
)

offset = tf.transpose([cutout_center_height, cutout_center_width], [1, 0])
return cutout(images, mask_size, offset, constant_values, data_format,)
return cutout(images, mask_size, offset, constant_values, data_format)


def cutout(
Expand Down
4 changes: 1 addition & 3 deletions tensorflow_addons/image/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,7 @@ def gaussian_filter2d(
gaussian_kernel_2d, [filter_shape[0], filter_shape[1], channels, 1]
)

image = _pad(
image, filter_shape, mode=padding, constant_values=constant_values,
)
image = _pad(image, filter_shape, mode=padding, constant_values=constant_values)

output = tf.nn.depthwise_conv2d(
input=image,
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_addons/image/interpolate_spline.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def interpolate_spline(
train_values to perform polyharmonic interpolation. The query values are
the values of the interpolant evaluated at the locations specified in
query_points.
"""
"""
with tf.name_scope(name or "interpolate_spline"):
train_points = tf.convert_to_tensor(train_points)
train_values = tf.convert_to_tensor(train_values)
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_addons/image/sparse_image_warp.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def _expand_to_minibatch(np_array: TensorLike, batch_size: TensorLike) -> Tensor


def _get_boundary_locations(
image_height: TensorLike, image_width: TensorLike, num_points_per_edge: TensorLike,
image_height: TensorLike, image_width: TensorLike, num_points_per_edge: TensorLike
) -> TensorLike:
"""Compute evenly-spaced indices along edge of image."""
y_range = np.linspace(0, image_height - 1, num_points_per_edge + 2)
Expand Down
4 changes: 2 additions & 2 deletions tensorflow_addons/image/tests/connected_components_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_multiple_images():
@pytest.mark.usefixtures("maybe_run_functions_eagerly")
def test_zeros():
np.testing.assert_equal(
connected_components(tf.zeros((100, 20, 50), tf.bool)), np.zeros((100, 20, 50)),
connected_components(tf.zeros((100, 20, 50), tf.bool)), np.zeros((100, 20, 50))
)


Expand All @@ -134,7 +134,7 @@ def test_ones():
def test_ones_small():

np.testing.assert_equal(
connected_components(tf.ones((3, 5), tf.bool)).numpy(), np.ones((3, 5)),
connected_components(tf.ones((3, 5), tf.bool)).numpy(), np.ones((3, 5))
)


Expand Down
7 changes: 4 additions & 3 deletions tensorflow_addons/image/tests/dense_image_warp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_interpolate_small_grid_ij():
shape=[1, 4, 3, 1],
)
query_points = tf.constant(
[[0.0, 0.0], [1.0, 0.0], [2.0, 0.5], [1.5, 1.5], [3.0, 2.0]], shape=[1, 5, 2],
[[0.0, 0.0], [1.0, 0.0], [2.0, 0.5], [1.5, 1.5], [3.0, 2.0]], shape=[1, 5, 2]
)
expected_results = np.reshape(np.array([0.0, 3.0, 6.5, 6.0, 11.0]), [1, 5, 1])

Expand All @@ -45,7 +45,7 @@ def test_interpolate_small_grid_xy():
shape=[1, 4, 3, 1],
)
query_points = tf.constant(
[[0.0, 0.0], [0.0, 1.0], [0.5, 2.0], [1.5, 1.5], [2.0, 3.0]], shape=[1, 5, 2],
[[0.0, 0.0], [0.0, 1.0], [0.5, 2.0], [1.5, 1.5], [2.0, 3.0]], shape=[1, 5, 2]
)
expected_results = np.reshape(np.array([0.0, 3.0, 6.5, 6.0, 11.0]), [1, 5, 1])

Expand Down Expand Up @@ -91,7 +91,8 @@ def _check_zero_flow_correctness(shape, image_type, flow_type):
rand_flows *= 0

interp = dense_image_warp(
image=tf.convert_to_tensor(rand_image), flow=tf.convert_to_tensor(rand_flows),
image=tf.convert_to_tensor(rand_image),
flow=tf.convert_to_tensor(rand_flows),
)

np.testing.assert_allclose(rand_image, interp, rtol=1e-6, atol=1e-6)
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_addons/image/tests/distort_image_ops_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test_adjust_hsv_in_yiq_unknown_shape():
image_np = np.random.rand(*shape) * 255.0
image_tf = tf.constant(image_np)
np.testing.assert_allclose(
_adjust_hue_in_yiq_np(image_np, 0), fn(image_tf), rtol=2e-4, atol=1e-4,
_adjust_hue_in_yiq_np(image_np, 0), fn(image_tf), rtol=2e-4, atol=1e-4
)


Expand Down
10 changes: 8 additions & 2 deletions tensorflow_addons/image/tests/filters_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def setup_values(
assert 3 <= len(image_shape) <= 4
height, width = image_shape[-3], image_shape[-2]
plane = tf.constant(
[x for x in range(1, height * width + 1)], shape=(height, width), dtype=dtype,
[x for x in range(1, height * width + 1)], shape=(height, width), dtype=dtype
)
image = tile_image(plane, image_shape=image_shape)

Expand Down Expand Up @@ -172,7 +172,13 @@ def test_reflect_padding_with_3x3_filter_mean(image_shape):

@pytest.mark.parametrize("image_shape", _image_shapes_to_test)
def test_reflect_padding_with_4x4_filter_mean(image_shape):
expected_plane = tf.constant([[5.0, 5.0, 5.0], [5.0, 5.0, 5.0], [5.0, 5.0, 5.0],])
expected_plane = tf.constant(
[
[5.0, 5.0, 5.0],
[5.0, 5.0, 5.0],
[5.0, 5.0, 5.0],
]
)

verify_values(
mean_filter2d,
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_addons/image/tests/sparse_image_warp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def assert_move_single_pixel(order, num_boundary_points, type_to_use):
# Shift it one pixel to the right.
control_point_displacements = [[0.0, 1.0]]
control_point_displacements = tf.constant(
np.float32(np.expand_dims(control_point_displacements, 0)), dtype=type_to_use,
np.float32(np.expand_dims(control_point_displacements, 0)), dtype=type_to_use
)

(warped_image, flow) = sparse_image_warp(
Expand Down
4 changes: 2 additions & 2 deletions tensorflow_addons/image/tests/transform_ops_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
@pytest.mark.parametrize("dtype", _DTYPES)
def test_compose(dtype):
image = tf.constant(
[[1, 1, 1, 0], [1, 0, 0, 0], [1, 1, 1, 0], [0, 0, 0, 0]], dtype=dtype,
[[1, 1, 1, 0], [1, 0, 0, 0], [1, 1, 1, 0], [0, 0, 0, 0]], dtype=dtype
)
# Rotate counter-clockwise by pi / 2.
rotation = transform_ops.angles_to_projective_transforms(np.pi / 2, 4, 4)
Expand All @@ -56,7 +56,7 @@ def test_compose(dtype):
@pytest.mark.parametrize("dtype", _DTYPES)
def test_extreme_projective_transform(dtype):
image = tf.constant(
[[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]], dtype=dtype,
[[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]], dtype=dtype
)
transformation = tf.constant([1, 0, 0, 0, 1, 0, -1, 0], tf.dtypes.float32)
image_transformed = transform_ops.transform(image, transformation)
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_addons/image/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def unwrap(image, replace):

Returns:
image: A 3D image `Tensor` with 3 channels.
"""
"""
image_shape = tf.shape(image)
# Flatten the spatial dimensions.
flattened_image = tf.reshape(image, [-1, image_shape[2]])
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_addons/layers/crf.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __init__(

if self.use_kernel:
self._dense_layer = tf.keras.layers.Dense(
units=self.units, dtype=self.dtype,
units=self.units, dtype=self.dtype
)
else:
self._dense_layer = lambda x: tf.cast(x, dtype=self.dtype)
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_addons/layers/esn.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class ESN(tf.keras.layers.RNN):
`recurrent_dropout` is used.
initial_state: List of initial state tensors to be passed to the first
call of the cell.
"""
"""

@typechecked
def __init__(
Expand Down
8 changes: 2 additions & 6 deletions tensorflow_addons/layers/spatial_pyramid_pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ def call(self, inputs, **kwargs):
new_input_height = dynamic_input_shape[1] - height_overflow
new_input_width = dynamic_input_shape[2] - width_overflow

new_inp = inputs[
:, :new_input_height, :new_input_width, :,
]
new_inp = inputs[:, :new_input_height, :new_input_width, :]
output = self.pool_layers[index](new_inp)
output = tf.reshape(
output, [dynamic_input_shape[0], bin[0] * bin[1], inputs.shape[-1]]
Expand All @@ -103,9 +101,7 @@ def call(self, inputs, **kwargs):
new_input_height = dynamic_input_shape[2] - height_overflow
new_input_width = dynamic_input_shape[3] - width_overflow

new_inp = inputs[
:, :, :new_input_height, :new_input_width,
]
new_inp = inputs[:, :, :new_input_height, :new_input_width]
output = self.pool_layers[index](new_inp)
output = tf.reshape(
output, [dynamic_input_shape[0], inputs.shape[1], bin[0] * bin[1]]
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_addons/layers/tests/maxout_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_nchw():
def test_unknown():
inputs = np.random.random((5, 4, 2, 18)).astype("float32")
test_utils.layer_test(
Maxout, kwargs={"num_units": 3}, input_shape=(5, 4, 2, None), input_data=inputs,
Maxout, kwargs={"num_units": 3}, input_shape=(5, 4, 2, None), input_data=inputs
)

test_utils.layer_test(
Expand Down
9 changes: 7 additions & 2 deletions tensorflow_addons/layers/tests/optical_flow_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,16 @@ def test_forward_simple(data_format):
actual = tf.transpose(actual, [0, 3, 1, 2])

# We can test fixed ids, as output is independent from data_format
expected_ids = np.concatenate([np.zeros(464,), np.ones(464,)])
expected_ids = np.concatenate(
[
np.zeros(464),
np.ones(464),
]
)
np.testing.assert_allclose(tf.where(actual == 0)[:, 0].numpy(), expected_ids)

counts = [54, 52, 54, 50, 44, 50, 54, 52, 54]
expected_ids = np.concatenate([k * np.ones(v,) for k, v in enumerate(counts)])
expected_ids = np.concatenate([k * np.ones(v) for k, v in enumerate(counts)])
expected_ids = np.concatenate([expected_ids, expected_ids])
np.testing.assert_allclose(tf.where(actual == 0)[:, 1], expected_ids)
assert actual.shape == (2, 9, 7, 8)
Expand Down
6 changes: 3 additions & 3 deletions tensorflow_addons/layers/tests/spectral_normalization_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_model_fit(base_layer_fn, input_shape, output_shape):
"base_layer_fn, input_shape",
[
(lambda: tf.keras.layers.Dense(2), [3, 2]),
(lambda: tf.keras.layers.Conv2D(3, (2, 2), padding="same"), [4, 4, 3],),
(lambda: tf.keras.layers.Conv2D(3, (2, 2), padding="same"), [4, 4, 3]),
(lambda: tf.keras.layers.Embedding(2, 10), [2]),
],
)
Expand All @@ -113,7 +113,7 @@ def test_normalization():
inputs = tf.keras.layers.Input(shape=[2, 2, 1])

base_layer = tf.keras.layers.Conv2D(
1, (2, 2), kernel_initializer=tf.constant_initializer(value=2),
1, (2, 2), kernel_initializer=tf.constant_initializer(value=2)
)
sn_layer = spectral_normalization.SpectralNormalization(base_layer)
model = tf.keras.models.Sequential(layers=[inputs, sn_layer])
Expand All @@ -125,7 +125,7 @@ def test_normalization():

for training in [False, True]:
_ = model(
tf.constant(np.ones((1, 2, 2, 1), dtype=np.float32)), training=training,
tf.constant(np.ones((1, 2, 2, 1), dtype=np.float32)), training=training
)
if training:
w = weights_normalized
Expand Down
6 changes: 3 additions & 3 deletions tensorflow_addons/layers/tests/wrappers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
def test_basic():
test_utils.layer_test(
wrappers.WeightNormalization,
kwargs={"layer": tf.keras.layers.Conv2D(5, (2, 2)),},
kwargs={"layer": tf.keras.layers.Conv2D(5, (2, 2))},
input_shape=(2, 4, 4, 3),
)


def test_no_bias():
test_utils.layer_test(
wrappers.WeightNormalization,
kwargs={"layer": tf.keras.layers.Dense(5, use_bias=False),},
kwargs={"layer": tf.keras.layers.Dense(5, use_bias=False)},
input_shape=(2, 4),
)

Expand All @@ -49,7 +49,7 @@ def _check_data_init(data_init, input_data, expected_output):
)
test_utils.layer_test(
wrappers.WeightNormalization,
kwargs={"layer": layer, "data_init": data_init,},
kwargs={"layer": layer, "data_init": data_init},
input_data=input_data,
expected_output=expected_output,
)
Expand Down
15 changes: 9 additions & 6 deletions tensorflow_addons/losses/metric_learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ def pairwise_distance(feature: TensorLike, squared: bool = False):
Returns:
pairwise_distances: 2-D Tensor of size `[number of data, number of data]`.
"""
pairwise_distances_squared = tf.math.add(
tf.math.reduce_sum(tf.math.square(feature), axis=[1], keepdims=True),
tf.math.reduce_sum(
tf.math.square(tf.transpose(feature)), axis=[0], keepdims=True
),
) - 2.0 * tf.matmul(feature, tf.transpose(feature))
pairwise_distances_squared = (
tf.math.add(
tf.math.reduce_sum(tf.math.square(feature), axis=[1], keepdims=True),
tf.math.reduce_sum(
tf.math.square(tf.transpose(feature)), axis=[0], keepdims=True
),
)
- 2.0 * tf.matmul(feature, tf.transpose(feature))
)

# Deal with numerical inaccuracies. Set small negatives to zero.
pairwise_distances_squared = tf.math.maximum(pairwise_distances_squared, 0.0)
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_addons/losses/tests/kappa_loss_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_quadratic_weighted_kappa_loss(np_seed):

def test_config():
kappa_loss = WeightedKappaLoss(
num_classes=4, weightage="linear", name="kappa_loss", epsilon=0.001,
num_classes=4, weightage="linear", name="kappa_loss", epsilon=0.001
)
assert kappa_loss.num_classes == 4
assert kappa_loss.weightage == "linear"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_addons/losses/tests/lifted_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_lifted_struct(dtype):

def test_keras_model_compile():
model = tf.keras.models.Sequential(
[tf.keras.layers.Input(shape=(784,)), tf.keras.layers.Dense(10),]
[tf.keras.layers.Input(shape=(784,)), tf.keras.layers.Dense(10)]
)
model.compile(loss="Addons>lifted_struct_loss", optimizer="adam")

Expand Down
4 changes: 2 additions & 2 deletions tensorflow_addons/losses/tests/triplet_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def test_semihard_tripled_loss_angular(dtype, dist_func, dist_metric):

def test_keras_model_compile_semihard():
model = tf.keras.models.Sequential(
[tf.keras.layers.Input(shape=(784,)), tf.keras.layers.Dense(10),]
[tf.keras.layers.Input(shape=(784,)), tf.keras.layers.Dense(10)]
)
model.compile(loss="Addons>triplet_semihard_loss", optimizer="adam")

Expand Down Expand Up @@ -225,7 +225,7 @@ def test_hard_tripled_loss_angular(dtype, soft, dist_func, dist_metric):

def test_keras_model_compile_hard():
model = tf.keras.models.Sequential(
[tf.keras.layers.Input(shape=(784,)), tf.keras.layers.Dense(10),]
[tf.keras.layers.Input(shape=(784,)), tf.keras.layers.Dense(10)]
)
model.compile(loss="Addons>triplet_hard_loss", optimizer="adam")

Expand Down
5 changes: 2 additions & 3 deletions tensorflow_addons/metrics/r_square.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
def _reduce_average(
input_tensor: tf.Tensor, axis=None, keepdims=False, weights=None
) -> tf.Tensor:
"""Computes the (weighted) mean of elements across dimensions of a tensor.
"""
"""Computes the (weighted) mean of elements across dimensions of a tensor."""
if weights is None:
return tf.reduce_mean(input_tensor, axis=axis, keepdims=keepdims)

Expand Down Expand Up @@ -116,7 +115,7 @@ def update_state(self, y_true, y_pred, sample_weight=None) -> None:
self.sum.assign_add(tf.reduce_sum(weighted_y_true, axis=0))
self.squared_sum.assign_add(tf.reduce_sum(y_true * weighted_y_true, axis=0))
self.res.assign_add(
tf.reduce_sum((y_true - y_pred) ** 2 * sample_weight, axis=0,)
tf.reduce_sum((y_true - y_pred) ** 2 * sample_weight, axis=0)
)
self.count.assign_add(tf.reduce_sum(sample_weight, axis=0))

Expand Down
Loading