Skip to content

Commit 9acab6a

Browse files
Bump black (#2135)
* Bump the black version. Fixes the ci. * Removed trailing commas. * Update tensorflow_addons/image/filters.py * Update tensorflow_addons/image/cutout_ops.py * Removed trailing commas. * Removed commas. * Removed some more commas. * Removed some commas. * Removed some commas. * Update tensorflow_addons/optimizers/moving_average.py * Update tensorflow_addons/losses/tests/kappa_loss_test.py * Update tensorflow_addons/layers/tests/wrappers_test.py * Update tensorflow_addons/layers/tests/wrappers_test.py * Update tensorflow_addons/layers/tests/wrappers_test.py * Update tensorflow_addons/layers/tests/spectral_normalization_test.py * Update tensorflow_addons/layers/tests/spectral_normalization_test.py * Update tensorflow_addons/losses/tests/triplet_test.py * Update tensorflow_addons/metrics/tests/hamming_test.py * Update tensorflow_addons/metrics/tests/multilabel_confusion_matrix_test.py * Update tensorflow_addons/optimizers/lookahead.py * Update tensorflow_addons/metrics/tests/multilabel_confusion_matrix_test.py * Update tensorflow_addons/metrics/r_square.py * Removed commas. * Removed commas.
1 parent ef8b0c9 commit 9acab6a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+168
-156
lines changed

build_deps/toolchains/gpu/find_cuda_config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,16 @@ def get_nvcc_version(path):
277277

278278
nvcc_name = "nvcc.exe" if _is_windows() else "nvcc"
279279
nvcc_path, nvcc_version = _find_versioned_file(
280-
base_paths, ["", "bin",], nvcc_name, cuda_version, get_nvcc_version
280+
base_paths,
281+
["", "bin"],
282+
nvcc_name,
283+
cuda_version,
284+
get_nvcc_version,
281285
)
282286

283287
nvvm_path = _find_file(
284288
base_paths,
285-
["nvvm/libdevice", "share/cuda", "lib/nvidia-cuda-toolkit/libdevice",],
289+
["nvvm/libdevice", "share/cuda", "lib/nvidia-cuda-toolkit/libdevice"],
286290
"libdevice*.10.bc",
287291
)
288292

tensorflow_addons/activations/tests/sparsemax_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def test_sparsemax_against_numpy_high_rank(dtype):
112112
def test_sparsemax_of_nan(dtype):
113113
"""check sparsemax transfers nan."""
114114
z_nan = np.asarray(
115-
[[0, np.nan, 0], [0, np.nan, np.nan], [np.nan, np.nan, np.nan],]
115+
[[0, np.nan, 0], [0, np.nan, np.nan], [np.nan, np.nan, np.nan]]
116116
).astype(dtype)
117117

118118
tf_sparsemax_nan = sparsemax(z_nan)
@@ -132,7 +132,7 @@ def test_sparsemax_of_nan(dtype):
132132
def test_sparsemax_of_inf(dtype):
133133
"""check sparsemax is infinity safe."""
134134
z_neg = np.asarray(
135-
[[0, -np.inf, 0], [0, -np.inf, -np.inf], [-np.inf, -np.inf, -np.inf],]
135+
[[0, -np.inf, 0], [0, -np.inf, -np.inf], [-np.inf, -np.inf, -np.inf]]
136136
).astype(dtype)
137137
z_pos = np.asarray(
138138
[[0, np.inf, 0], [0, np.inf, np.inf], [np.inf, np.inf, np.inf]]

tensorflow_addons/image/compose_ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def blend(image1: TensorLike, image2: TensorLike, factor: Number) -> tf.Tensor:
4343
Returns:
4444
A blended image Tensor of `tf.float32`.
4545
46-
"""
46+
"""
4747
with tf.name_scope("blend"):
4848

4949
if factor == 0.0:

tensorflow_addons/image/cutout_ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def random_cutout(
100100
)
101101

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

105105

106106
def cutout(

tensorflow_addons/image/filters.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,7 @@ def gaussian_filter2d(
304304
gaussian_kernel_2d, [filter_shape[0], filter_shape[1], channels, 1]
305305
)
306306

307-
image = _pad(
308-
image, filter_shape, mode=padding, constant_values=constant_values,
309-
)
307+
image = _pad(image, filter_shape, mode=padding, constant_values=constant_values)
310308

311309
output = tf.nn.depthwise_conv2d(
312310
input=image,

tensorflow_addons/image/interpolate_spline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def interpolate_spline(
296296
train_values to perform polyharmonic interpolation. The query values are
297297
the values of the interpolant evaluated at the locations specified in
298298
query_points.
299-
"""
299+
"""
300300
with tf.name_scope(name or "interpolate_spline"):
301301
train_points = tf.convert_to_tensor(train_points)
302302
train_values = tf.convert_to_tensor(train_values)

tensorflow_addons/image/sparse_image_warp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def _expand_to_minibatch(np_array: TensorLike, batch_size: TensorLike) -> Tensor
3939

4040

4141
def _get_boundary_locations(
42-
image_height: TensorLike, image_width: TensorLike, num_points_per_edge: TensorLike,
42+
image_height: TensorLike, image_width: TensorLike, num_points_per_edge: TensorLike
4343
) -> TensorLike:
4444
"""Compute evenly-spaced indices along edge of image."""
4545
y_range = np.linspace(0, image_height - 1, num_points_per_edge + 2)

tensorflow_addons/image/tests/connected_components_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def test_multiple_images():
118118
@pytest.mark.usefixtures("maybe_run_functions_eagerly")
119119
def test_zeros():
120120
np.testing.assert_equal(
121-
connected_components(tf.zeros((100, 20, 50), tf.bool)), np.zeros((100, 20, 50)),
121+
connected_components(tf.zeros((100, 20, 50), tf.bool)), np.zeros((100, 20, 50))
122122
)
123123

124124

@@ -134,7 +134,7 @@ def test_ones():
134134
def test_ones_small():
135135

136136
np.testing.assert_equal(
137-
connected_components(tf.ones((3, 5), tf.bool)).numpy(), np.ones((3, 5)),
137+
connected_components(tf.ones((3, 5), tf.bool)).numpy(), np.ones((3, 5))
138138
)
139139

140140

tensorflow_addons/image/tests/dense_image_warp_test.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_interpolate_small_grid_ij():
3030
shape=[1, 4, 3, 1],
3131
)
3232
query_points = tf.constant(
33-
[[0.0, 0.0], [1.0, 0.0], [2.0, 0.5], [1.5, 1.5], [3.0, 2.0]], shape=[1, 5, 2],
33+
[[0.0, 0.0], [1.0, 0.0], [2.0, 0.5], [1.5, 1.5], [3.0, 2.0]], shape=[1, 5, 2]
3434
)
3535
expected_results = np.reshape(np.array([0.0, 3.0, 6.5, 6.0, 11.0]), [1, 5, 1])
3636

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

@@ -91,7 +91,8 @@ def _check_zero_flow_correctness(shape, image_type, flow_type):
9191
rand_flows *= 0
9292

9393
interp = dense_image_warp(
94-
image=tf.convert_to_tensor(rand_image), flow=tf.convert_to_tensor(rand_flows),
94+
image=tf.convert_to_tensor(rand_image),
95+
flow=tf.convert_to_tensor(rand_flows),
9596
)
9697

9798
np.testing.assert_allclose(rand_image, interp, rtol=1e-6, atol=1e-6)

tensorflow_addons/image/tests/distort_image_ops_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def test_adjust_hsv_in_yiq_unknown_shape():
125125
image_np = np.random.rand(*shape) * 255.0
126126
image_tf = tf.constant(image_np)
127127
np.testing.assert_allclose(
128-
_adjust_hue_in_yiq_np(image_np, 0), fn(image_tf), rtol=2e-4, atol=1e-4,
128+
_adjust_hue_in_yiq_np(image_np, 0), fn(image_tf), rtol=2e-4, atol=1e-4
129129
)
130130

131131

0 commit comments

Comments
 (0)