diff --git a/tensorflow_addons/custom_ops/image/cc/kernels/euclidean_distance_transform_op.h b/tensorflow_addons/custom_ops/image/cc/kernels/euclidean_distance_transform_op.h index 575e5ade39..65940fd099 100644 --- a/tensorflow_addons/custom_ops/image/cc/kernels/euclidean_distance_transform_op.h +++ b/tensorflow_addons/custom_ops/image/cc/kernels/euclidean_distance_transform_op.h @@ -38,8 +38,8 @@ class EuclideanDistanceTransformGenerator { int64 height_, width_; public: - EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE - EuclideanDistanceTransformGenerator(typename TTypes::ConstTensor input) + EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE EuclideanDistanceTransformGenerator( + typename TTypes::ConstTensor input) : input_(input) { height_ = input_.dimensions()[1]; width_ = input_.dimensions()[2]; diff --git a/tensorflow_addons/image/utils.py b/tensorflow_addons/image/utils.py index 036a4caaa1..9fe8d159c4 100644 --- a/tensorflow_addons/image/utils.py +++ b/tensorflow_addons/image/utils.py @@ -35,12 +35,11 @@ def to_4D_image(image): Returns: 4D tensor with the same type. """ - # yapf:disable with tf.control_dependencies([ - tf.debugging.assert_rank_in( - image, [2, 3, 4], message='`image` must be 2/3/4D tensor') + tf.debugging.assert_rank_in( # pylint: disable=bad-continuation + image, [2, 3, 4], + message='`image` must be 2/3/4D tensor') ]): - # yapf: enable ndims = image.get_shape().ndims if ndims is None: return _dynamic_to_4D_image(image) @@ -81,12 +80,12 @@ def from_4D_image(image, ndims): Returns: `ndims`-D tensor with the same type. """ - # yapf:disable with tf.control_dependencies([ - tf.debugging.assert_rank( - image, 4, message='`image` must be 4D tensor') + tf.debugging.assert_rank( # pylint: disable=bad-continuation + image, + 4, + message='`image` must be 4D tensor') ]): - # yapf:enable if isinstance(ndims, tf.Tensor): return _dynamic_from_4D_image(image, ndims) elif ndims == 2: diff --git a/tensorflow_addons/optimizers/weight_decay_optimizers.py b/tensorflow_addons/optimizers/weight_decay_optimizers.py index 4759538d9a..4ba23ac93f 100644 --- a/tensorflow_addons/optimizers/weight_decay_optimizers.py +++ b/tensorflow_addons/optimizers/weight_decay_optimizers.py @@ -226,7 +226,7 @@ def extend_with_decoupled_weight_decay(base_optimizer): optimizer = tfa.optimizers.AdamW(learning_rate=lr, weight_decay=wd) ``` - + Note: you might want to register your own custom optimizer using `tf.keras.utils.get_custom_objects()`. diff --git a/tensorflow_addons/seq2seq/beam_search_decoder.py b/tensorflow_addons/seq2seq/beam_search_decoder.py index 0bc9074c72..895730e98c 100644 --- a/tensorflow_addons/seq2seq/beam_search_decoder.py +++ b/tensorflow_addons/seq2seq/beam_search_decoder.py @@ -514,8 +514,13 @@ def _maybe_sort_array_beams(self, t, parent_ids, sequence_length): self._beam_width): return t t = t.stack() + # yapf:disable with tf.control_dependencies( - [_check_batch_beam(t, self._batch_size, self._beam_width)]): + [_check_batch_beam( # pylint: disable=bad-continuation + t, + self._batch_size, + self._beam_width)]): + # yapf:enable return gather_tree_from_array(t, parent_ids, sequence_length) def step(self, time, inputs, state, training=None, name=None): diff --git a/tools/ci_build/install/ci_requirements.txt b/tools/ci_build/install/ci_requirements.txt index f295d1828e..d54886f791 100644 --- a/tools/ci_build/install/ci_requirements.txt +++ b/tools/ci_build/install/ci_requirements.txt @@ -1,4 +1,4 @@ -# TODO: Upgrade pylint to 2.0 when python >= 3.4 -pylint == 1.6.4 +pylint == 1.9 ; python_version <= '2.7' +pylint == 2.3.1 ; python_version > '2.7' docformatter == 1.1 yapf == 0.26.0 diff --git a/tools/ci_build/install/install_ci_dependency.sh b/tools/ci_build/install/install_ci_dependency.sh index 1e8ff534bc..b1bca67423 100644 --- a/tools/ci_build/install/install_ci_dependency.sh +++ b/tools/ci_build/install/install_ci_dependency.sh @@ -36,11 +36,11 @@ if [[ ! -d "tensorflow_addons" ]]; then exit 1 fi -# Install python +# Install python dependencies: CI_REQUIREMENT="$SCRIPT_DIR/ci_requirements.txt" pip install ${QUIET_FLAG} -r ${CI_REQUIREMENT} -# Check clang-format +# Check clang-format: CLANG_FORMAT=${CLANG_FORMAT:-clang-format-3.8} which ${CLANG_FORMAT} > /dev/null if [[ $? != "0" ]]; then diff --git a/tools/ci_build/pylintrc b/tools/ci_build/pylintrc index e2139e6220..fa000e12f3 100644 --- a/tools/ci_build/pylintrc +++ b/tools/ci_build/pylintrc @@ -70,6 +70,7 @@ disable=design, # TODO: remove not-callable when pylint can understand tf export paradigm not-callable, similarities, + unsupported-assignment-operation, useless-object-inheritance # Enable the message, report, category or checker with the given id(s). You can