Skip to content

Commit c6be389

Browse files
committed
Merge branch 'master' into pr/ashutosh1919/1728
2 parents 176c46e + 4cfe121 commit c6be389

File tree

26 files changed

+288
-43
lines changed

26 files changed

+288
-43
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
matrix:
4242
os: ['macos-latest', 'windows-latest', 'ubuntu-18.04']
4343
py-version: ['3.5', '3.6', '3.7', '3.8']
44-
tf-version: ['2.1.0', '2.2.0rc3']
44+
tf-version: ['2.2.0rc3']
4545
fail-fast: false
4646
steps:
4747
- uses: actions/[email protected]
@@ -58,9 +58,7 @@ jobs:
5858
with:
5959
python-version: ${{ matrix.py-version }}
6060
- name: Build wheels
61-
if: |
62-
(matrix.py-version != '3.8' || matrix.tf-version != '2.1.0')
63-
&& (github.event_name != 'pull_request' || matrix.py-version == env.MIN_PY_VERSION || matrix.py-version == env.MAX_PY_VERSION)
61+
if: github.event_name != 'pull_request' || matrix.py-version == env.MIN_PY_VERSION || matrix.py-version == env.MAX_PY_VERSION
6462
env:
6563
OS: ${{ runner.os }}
6664
PY_VERSION: ${{ matrix.py-version }}
@@ -69,9 +67,7 @@ jobs:
6967
shell: bash
7068
run: bash .github/workflows/make_wheel_${OS}.sh
7169
- uses: actions/upload-artifact@v1
72-
if: |
73-
(matrix.py-version != '3.8' || matrix.tf-version != '2.1.0')
74-
&& (github.event_name != 'pull_request' || matrix.py-version == env.MIN_PY_VERSION || matrix.py-version == env.MAX_PY_VERSION)
70+
if: github.event_name != 'pull_request' || matrix.py-version == env.MIN_PY_VERSION || matrix.py-version == env.MAX_PY_VERSION
7571
with:
7672
name: ${{ runner.os }}-${{ matrix.py-version }}-tf${{ matrix.tf-version }}-wheel
7773
path: wheelhouse
@@ -88,7 +84,7 @@ jobs:
8884
- uses: actions/download-artifact@v1
8985
if: github.event_name != 'pull_request' || matrix.py-version == env.MIN_PY_VERSION || matrix.py-version == env.MAX_PY_VERSION
9086
with:
91-
name: ${{ matrix.os }}-${{ matrix.py-version }}-tf2.1.0-wheel
87+
name: ${{ matrix.os }}-${{ matrix.py-version }}-tf2.2.0rc3-wheel
9288
path: ./dist
9389
- if: github.event_name != 'pull_request' || matrix.py-version == env.MIN_PY_VERSION || matrix.py-version == env.MAX_PY_VERSION
9490
run: |

CONTRIBUTING.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ conda activate my_dev_environement
160160
Just run from the root:
161161

162162
```
163+
pip install tensorflow==2.2.0rc3
164+
# you can use "pip install tensorflow-cpu==2.2.0rc3" too if you're not testing on gpu.
163165
pip install -e ./
164166
```
165167

@@ -247,7 +249,7 @@ If you need a custom C++/Cuda op for your test, compile your ops with
247249

248250
```bash
249251
python configure.py
250-
pip install tensorflow==2.1.0 -e ./ -r tools/install_deps/pytest.txt
252+
pip install tensorflow==2.2.0rc3 -e ./ -r tools/install_deps/pytest.txt
251253
bash tools/install_so_files.sh # Linux/macos/WSL2
252254
sh tools/install_so_files.sh # PowerShell
253255
```
@@ -275,14 +277,14 @@ docker run --runtime=nvidia --rm -it -v ${PWD}:/addons -w /addons tensorflow/ten
275277

276278
Configure:
277279
```
278-
python3 -m pip install tensorflow==2.1.0
280+
python3 -m pip install tensorflow==2.2.0rc3
279281
python3 ./configure.py # Links project with TensorFlow dependency
280282
```
281283

282284
Install in editable mode
283285
```
284286
python3 -m pip install -e .
285-
python3 -m pip install pytest pytest-xdist
287+
python3 -m pip install -r tools/install_deps/pytest.txt
286288
```
287289

288290
Compile the custom ops
@@ -309,9 +311,9 @@ quickly, as Bazel has great support for caching and distributed testing.
309311
To test with Bazel:
310312

311313
```
312-
python3 -m pip install tensorflow==2.1.0
314+
python3 -m pip install tensorflow==2.2.0rc3
313315
python3 configure.py
314-
python3 -m pip install pytest
316+
python3 -m pip install -r tools/install_deps/pytest.txt
315317
bazel test -c opt -k \
316318
--test_timeout 300,450,1200,3600 \
317319
--test_output=all \

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ what it was tested against.
7171
#### Python-Op Compatibility Matrix
7272
| TFA Version | TensorFlow | Python |
7373
|:----------------------- |:---|:---------- |
74-
| tfa-nightly | 2.1, 2.2 | 3.5, 3.6, 3.7, 3.8 |
75-
| tensorflow-addons-0.9.1 | 2.1 |3.5, 3.6, 3.7, 3.8 |
74+
| tfa-nightly | 2.2 | 3.5, 3.6, 3.7, 3.8 |
75+
| tensorflow-addons-0.9.1 | 2.1,2.2 |3.5, 3.6, 3.7, 3.8 |
7676
| tensorflow-addons-0.8.3 | 2.1 |3.5, 3.6, 3.7 |
7777
| tensorflow-addons-0.7.1 | 2.1 | 2.7, 3.5, 3.6, 3.7 |
7878
| tensorflow-addons-0.6.0 | 2.0 | 2.7, 3.5, 3.6, 3.7 |
@@ -102,7 +102,7 @@ compiled differently. A typical reason for this would be conda installed TensorF
102102
#### Custom-Op Compatibility Matrix
103103
| TFA Version | TensorFlow | Compiler | cuDNN | CUDA |
104104
|:----------------------- |:---- |:---------|:---------|:---------|
105-
| tfa-nightly | 2.1 | GCC 7.3.1 | 7.6 | 10.1 |
105+
| tfa-nightly | 2.2 | GCC 7.3.1 | 7.6 | 10.1 |
106106
| tensorflow-addons-0.9.1 | 2.1 | GCC 7.3.1 | 7.6 | 10.1 |
107107
| tensorflow-addons-0.8.3 | 2.1 | GCC 7.3.1 | 7.6 | 10.1 |
108108
| tensorflow-addons-0.7.1 | 2.1 | GCC 7.3.1 | 7.6 | 10.1 |

tensorflow_addons/activations/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ py_library(
88
data = [
99
"//tensorflow_addons:options.py",
1010
"//tensorflow_addons/custom_ops/activations:_activation_ops.so",
11+
"//tensorflow_addons/testing",
1112
"//tensorflow_addons/utils",
1213
],
1314
)

tensorflow_addons/callbacks/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ py_library(
77
srcs = glob(["*.py"]),
88
deps = [
99
"//tensorflow_addons/optimizers",
10+
"//tensorflow_addons/testing",
1011
"//tensorflow_addons/utils",
1112
],
1213
)

tensorflow_addons/callbacks/tests/tqdm_progress_bar_test.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ def test_tqdm_progress_bar_show(capsys, show_epoch_progress, show_overall_progre
104104
assert ("epochs/s" in fit_stderr) is show_overall_progress
105105

106106
if show_epoch_progress and not show_overall_progress:
107-
# in 2.1.0, they are present in the logs
108-
# in 2.2.0+, they're not
109-
# in any case, they shouldn't appear.
110107
assert "size" not in fit_stderr
111108
assert "batch" not in fit_stderr
112109

tensorflow_addons/image/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ py_library(
1010
"//tensorflow_addons/custom_ops/image:_distort_image_ops.so",
1111
"//tensorflow_addons/custom_ops/image:_image_ops.so",
1212
"//tensorflow_addons/custom_ops/image:_resampler_ops.so",
13+
"//tensorflow_addons/testing",
1314
"//tensorflow_addons/utils",
1415
],
1516
)

tensorflow_addons/layers/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ py_library(
1010
],
1111
deps = [
1212
"//tensorflow_addons/activations",
13+
"//tensorflow_addons/testing",
1314
"//tensorflow_addons/utils",
1415
],
1516
)

tensorflow_addons/layers/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616

1717
from tensorflow_addons.layers.adaptive_pooling import (
1818
AdaptiveAveragePooling1D,
19+
AdaptiveMaxPooling1D,
1920
AdaptiveAveragePooling2D,
21+
AdaptiveMaxPooling2D,
2022
AdaptiveAveragePooling3D,
23+
AdaptiveMaxPooling3D,
2124
)
2225
from tensorflow_addons.layers.gelu import GELU
2326
from tensorflow_addons.layers.maxout import Maxout

tensorflow_addons/layers/adaptive_pooling.py

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,40 @@ def __init__(
120120
super().__init__(tf.reduce_mean, output_size, data_format, **kwargs)
121121

122122

123+
@tf.keras.utils.register_keras_serializable(package="Addons")
124+
class AdaptiveMaxPooling1D(AdaptivePooling1D):
125+
"""Max Pooling with adaptive kernel size.
126+
127+
Arguments:
128+
output_size: An integer or tuple/list of a single integer, specifying pooled_features.
129+
The new size of output channels.
130+
data_format: A string,
131+
one of `channels_last` (default) or `channels_first`.
132+
The ordering of the dimensions in the inputs.
133+
`channels_last` corresponds to inputs with shape
134+
`(batch, steps, channels)` while `channels_first`
135+
corresponds to inputs with shape `(batch, channels, steps)`.
136+
137+
Input shape:
138+
- If `data_format='channels_last'`:
139+
3D tensor with shape `(batch, steps, channels)`.
140+
- If `data_format='channels_first'`:
141+
3D tensor with shape `(batch, channels, steps)`.
142+
143+
Output shape:
144+
- If `data_format='channels_last'`:
145+
3D tensor with shape `(batch_size, pooled_steps, channels)`.
146+
- If `data_format='channels_first'`:
147+
3D tensor with shape `(batch_size, channels, pooled_steps)`.
148+
"""
149+
150+
@typechecked
151+
def __init__(
152+
self, output_size: Union[int, Iterable[int]], data_format=None, **kwargs
153+
):
154+
super().__init__(tf.reduce_max, output_size, data_format, **kwargs)
155+
156+
123157
class AdaptivePooling2D(tf.keras.layers.Layer):
124158
"""Parent class for 2D pooling layers with adaptive kernel size.
125159
@@ -234,6 +268,40 @@ def __init__(
234268
super().__init__(tf.reduce_mean, output_size, data_format, **kwargs)
235269

236270

271+
@tf.keras.utils.register_keras_serializable(package="Addons")
272+
class AdaptiveMaxPooling2D(AdaptivePooling2D):
273+
"""Max Pooling with adaptive kernel size.
274+
275+
Arguments:
276+
output_size: Tuple of integers specifying (pooled_rows, pooled_cols).
277+
The new size of output channels.
278+
data_format: A string,
279+
one of `channels_last` (default) or `channels_first`.
280+
The ordering of the dimensions in the inputs.
281+
`channels_last` corresponds to inputs with shape
282+
`(batch, height, width, channels)` while `channels_first`
283+
corresponds to inputs with shape `(batch, channels, height, width)`.
284+
285+
Input shape:
286+
- If `data_format='channels_last'`:
287+
4D tensor with shape `(batch_size, height, width, channels)`.
288+
- If `data_format='channels_first'`:
289+
4D tensor with shape `(batch_size, channels, height, width)`.
290+
291+
Output shape:
292+
- If `data_format='channels_last'`:
293+
4D tensor with shape `(batch_size, pooled_rows, pooled_cols, channels)`.
294+
- If `data_format='channels_first'`:
295+
4D tensor with shape `(batch_size, channels, pooled_rows, pooled_cols)`.
296+
"""
297+
298+
@typechecked
299+
def __init__(
300+
self, output_size: Union[int, Iterable[int]], data_format=None, **kwargs
301+
):
302+
super().__init__(tf.reduce_max, output_size, data_format, **kwargs)
303+
304+
237305
class AdaptivePooling3D(tf.keras.layers.Layer):
238306
"""Parent class for 3D pooling layers with adaptive kernel size.
239307
@@ -353,3 +421,37 @@ def __init__(
353421
self, output_size: Union[int, Iterable[int]], data_format=None, **kwargs
354422
):
355423
super().__init__(tf.reduce_mean, output_size, data_format, **kwargs)
424+
425+
426+
@tf.keras.utils.register_keras_serializable(package="Addons")
427+
class AdaptiveMaxPooling3D(AdaptivePooling3D):
428+
"""Max Pooling with adaptive kernel size.
429+
430+
Arguments:
431+
output_size: An integer or tuple/list of 3 integers specifying (pooled_depth, pooled_height, pooled_width).
432+
The new size of output channels.
433+
data_format: A string,
434+
one of `channels_last` (default) or `channels_first`.
435+
The ordering of the dimensions in the inputs.
436+
`channels_last` corresponds to inputs with shape
437+
`(batch, height, width, channels)` while `channels_first`
438+
corresponds to inputs with shape `(batch, channels, height, width)`.
439+
440+
Input shape:
441+
- If `data_format='channels_last'`:
442+
5D tensor with shape `(batch_size, spatial_dim1, spatial_dim2, spatial_dim3, channels)`.
443+
- If `data_format='channels_first'`:
444+
5D tensor with shape `(batch_size, channels, spatial_dim1, spatial_dim2, spatial_dim3)`.
445+
446+
Output shape:
447+
- If `data_format='channels_last'`:
448+
5D tensor with shape `(batch_size, pooled_dim1, pooled_dim2, pooled_dim3, channels)`.
449+
- If `data_format='channels_first'`:
450+
5D tensor with shape `(batch_size, channels, pooled_dim1, pooled_dim2, pooled_dim3)`.
451+
"""
452+
453+
@typechecked
454+
def __init__(
455+
self, output_size: Union[int, Iterable[int]], data_format=None, **kwargs
456+
):
457+
super().__init__(tf.reduce_max, output_size, data_format, **kwargs)

0 commit comments

Comments
 (0)