The following issues were found
keras/layers/core/spatial_dropout.py
51 issues
Line: 17
Column: 1
# ==============================================================================
"""Contains the spatial dropout layers."""
# pylint: disable=g-classes-have-attributes,g-direct-tensorflow-import,g-bad-import-order
import tensorflow.compat.v2 as tf
# pylint: enable=g-bad-import-order
import keras.backend as K
from keras.engine.input_spec import InputSpec
Reported by Pylint.
Line: 17
Column: 1
# ==============================================================================
"""Contains the spatial dropout layers."""
# pylint: disable=g-classes-have-attributes,g-direct-tensorflow-import,g-bad-import-order
import tensorflow.compat.v2 as tf
# pylint: enable=g-bad-import-order
import keras.backend as K
from keras.engine.input_spec import InputSpec
Reported by Pylint.
Line: 17
Column: 1
# ==============================================================================
"""Contains the spatial dropout layers."""
# pylint: disable=g-classes-have-attributes,g-direct-tensorflow-import,g-bad-import-order
import tensorflow.compat.v2 as tf
# pylint: enable=g-bad-import-order
import keras.backend as K
from keras.engine.input_spec import InputSpec
Reported by Pylint.
Line: 18
Column: 1
"""Contains the spatial dropout layers."""
# pylint: disable=g-classes-have-attributes,g-direct-tensorflow-import,g-bad-import-order
import tensorflow.compat.v2 as tf
# pylint: enable=g-bad-import-order
import keras.backend as K
from keras.engine.input_spec import InputSpec
from keras.layers.core.dropout import Dropout
Reported by Pylint.
Line: 19
Column: 1
# pylint: disable=g-classes-have-attributes,g-direct-tensorflow-import,g-bad-import-order
import tensorflow.compat.v2 as tf
# pylint: enable=g-bad-import-order
import keras.backend as K
from keras.engine.input_spec import InputSpec
from keras.layers.core.dropout import Dropout
Reported by Pylint.
Line: 25
Column: 1
from keras.engine.input_spec import InputSpec
from keras.layers.core.dropout import Dropout
from tensorflow.python.util.tf_export import keras_export
@keras_export('keras.layers.SpatialDropout1D')
class SpatialDropout1D(Dropout):
"""Spatial 1D version of Dropout.
Reported by Pylint.
Line: 30
Column: 1
@keras_export('keras.layers.SpatialDropout1D')
class SpatialDropout1D(Dropout):
"""Spatial 1D version of Dropout.
This version performs the same function as Dropout, however, it drops
entire 1D feature maps instead of individual elements. If adjacent frames
within feature maps are strongly correlated (as is normally the case in
early convolution layers) then regular dropout will not regularize the
Reported by Pylint.
Line: 53
Column: 1
Networks](https://arxiv.org/abs/1411.4280)
"""
def __init__(self, rate, **kwargs):
super(SpatialDropout1D, self).__init__(rate, **kwargs)
self.input_spec = InputSpec(ndim=3)
def _get_noise_shape(self, inputs):
input_shape = tf.shape(inputs)
Reported by Pylint.
Line: 54
Column: 5
"""
def __init__(self, rate, **kwargs):
super(SpatialDropout1D, self).__init__(rate, **kwargs)
self.input_spec = InputSpec(ndim=3)
def _get_noise_shape(self, inputs):
input_shape = tf.shape(inputs)
noise_shape = (input_shape[0], 1, input_shape[2])
Reported by Pylint.
Line: 54
Column: 1
"""
def __init__(self, rate, **kwargs):
super(SpatialDropout1D, self).__init__(rate, **kwargs)
self.input_spec = InputSpec(ndim=3)
def _get_noise_shape(self, inputs):
input_shape = tf.shape(inputs)
noise_shape = (input_shape[0], 1, input_shape[2])
Reported by Pylint.
keras/benchmarks/keras_examples_benchmarks/bidirectional_lstm_benchmark_test.py
51 issues
Line: 20
Column: 1
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from keras.benchmarks import benchmark_util
class BidirectionalLSTMBenchmark(tf.test.Benchmark):
Reported by Pylint.
Line: 22
Column: 1
import tensorflow as tf
from keras.benchmarks import benchmark_util
class BidirectionalLSTMBenchmark(tf.test.Benchmark):
"""Benchmarks for Bidirectional LSTM using `tf.test.Benchmark`."""
Reported by Pylint.
Line: 26
Column: 1
class BidirectionalLSTMBenchmark(tf.test.Benchmark):
"""Benchmarks for Bidirectional LSTM using `tf.test.Benchmark`."""
def __init__(self):
super(BidirectionalLSTMBenchmark, self).__init__()
self.max_feature = 20000
self.max_len = 200
Reported by Pylint.
Line: 28
Column: 1
class BidirectionalLSTMBenchmark(tf.test.Benchmark):
"""Benchmarks for Bidirectional LSTM using `tf.test.Benchmark`."""
def __init__(self):
super(BidirectionalLSTMBenchmark, self).__init__()
self.max_feature = 20000
self.max_len = 200
(self.imdb_x, self.imdb_y), _ = tf.keras.datasets.imdb.load_data(
num_words=self.max_feature)
Reported by Pylint.
Line: 29
Column: 1
"""Benchmarks for Bidirectional LSTM using `tf.test.Benchmark`."""
def __init__(self):
super(BidirectionalLSTMBenchmark, self).__init__()
self.max_feature = 20000
self.max_len = 200
(self.imdb_x, self.imdb_y), _ = tf.keras.datasets.imdb.load_data(
num_words=self.max_feature)
self.imdb_x = tf.keras.preprocessing.sequence.pad_sequences(
Reported by Pylint.
Line: 29
Column: 5
"""Benchmarks for Bidirectional LSTM using `tf.test.Benchmark`."""
def __init__(self):
super(BidirectionalLSTMBenchmark, self).__init__()
self.max_feature = 20000
self.max_len = 200
(self.imdb_x, self.imdb_y), _ = tf.keras.datasets.imdb.load_data(
num_words=self.max_feature)
self.imdb_x = tf.keras.preprocessing.sequence.pad_sequences(
Reported by Pylint.
Line: 30
Column: 1
def __init__(self):
super(BidirectionalLSTMBenchmark, self).__init__()
self.max_feature = 20000
self.max_len = 200
(self.imdb_x, self.imdb_y), _ = tf.keras.datasets.imdb.load_data(
num_words=self.max_feature)
self.imdb_x = tf.keras.preprocessing.sequence.pad_sequences(
self.imdb_x, maxlen=self.max_len)
Reported by Pylint.
Line: 31
Column: 1
def __init__(self):
super(BidirectionalLSTMBenchmark, self).__init__()
self.max_feature = 20000
self.max_len = 200
(self.imdb_x, self.imdb_y), _ = tf.keras.datasets.imdb.load_data(
num_words=self.max_feature)
self.imdb_x = tf.keras.preprocessing.sequence.pad_sequences(
self.imdb_x, maxlen=self.max_len)
Reported by Pylint.
Line: 32
Column: 1
super(BidirectionalLSTMBenchmark, self).__init__()
self.max_feature = 20000
self.max_len = 200
(self.imdb_x, self.imdb_y), _ = tf.keras.datasets.imdb.load_data(
num_words=self.max_feature)
self.imdb_x = tf.keras.preprocessing.sequence.pad_sequences(
self.imdb_x, maxlen=self.max_len)
def _build_model(self):
Reported by Pylint.
Line: 34
Column: 1
self.max_len = 200
(self.imdb_x, self.imdb_y), _ = tf.keras.datasets.imdb.load_data(
num_words=self.max_feature)
self.imdb_x = tf.keras.preprocessing.sequence.pad_sequences(
self.imdb_x, maxlen=self.max_len)
def _build_model(self):
"""Model from https://keras.io/examples/nlp/bidirectional_lstm_imdb/."""
inputs = tf.keras.Input(shape=(None,), dtype='int32')
Reported by Pylint.
keras/benchmarks/keras_examples_benchmarks/reuters_mlp_benchmark_test.py
51 issues
Line: 20
Column: 1
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
from keras.benchmarks import benchmark_util
Reported by Pylint.
Line: 24
Column: 1
import numpy as np
from keras.benchmarks import benchmark_util
class MLPReutersBenchmark(tf.test.Benchmark):
"""Benchmarks for MLP using `tf.test.Benchmark`."""
Reported by Pylint.
Line: 28
Column: 1
class MLPReutersBenchmark(tf.test.Benchmark):
"""Benchmarks for MLP using `tf.test.Benchmark`."""
def __init__(self):
super(MLPReutersBenchmark, self).__init__()
self.max_words = 1000
(self.x_train, self.y_train), _ = tf.keras.datasets.reuters.load_data(
Reported by Pylint.
Line: 30
Column: 1
class MLPReutersBenchmark(tf.test.Benchmark):
"""Benchmarks for MLP using `tf.test.Benchmark`."""
def __init__(self):
super(MLPReutersBenchmark, self).__init__()
self.max_words = 1000
(self.x_train, self.y_train), _ = tf.keras.datasets.reuters.load_data(
num_words=self.max_words)
self.num_classes = np.max(self.y_train) + 1
Reported by Pylint.
Line: 31
Column: 1
"""Benchmarks for MLP using `tf.test.Benchmark`."""
def __init__(self):
super(MLPReutersBenchmark, self).__init__()
self.max_words = 1000
(self.x_train, self.y_train), _ = tf.keras.datasets.reuters.load_data(
num_words=self.max_words)
self.num_classes = np.max(self.y_train) + 1
tokenizer = tf.keras.preprocessing.text.Tokenizer(num_words=self.max_words)
Reported by Pylint.
Line: 31
Column: 5
"""Benchmarks for MLP using `tf.test.Benchmark`."""
def __init__(self):
super(MLPReutersBenchmark, self).__init__()
self.max_words = 1000
(self.x_train, self.y_train), _ = tf.keras.datasets.reuters.load_data(
num_words=self.max_words)
self.num_classes = np.max(self.y_train) + 1
tokenizer = tf.keras.preprocessing.text.Tokenizer(num_words=self.max_words)
Reported by Pylint.
Line: 32
Column: 1
def __init__(self):
super(MLPReutersBenchmark, self).__init__()
self.max_words = 1000
(self.x_train, self.y_train), _ = tf.keras.datasets.reuters.load_data(
num_words=self.max_words)
self.num_classes = np.max(self.y_train) + 1
tokenizer = tf.keras.preprocessing.text.Tokenizer(num_words=self.max_words)
self.x_train = tokenizer.sequences_to_matrix(self.x_train, mode='binary')
Reported by Pylint.
Line: 33
Column: 1
def __init__(self):
super(MLPReutersBenchmark, self).__init__()
self.max_words = 1000
(self.x_train, self.y_train), _ = tf.keras.datasets.reuters.load_data(
num_words=self.max_words)
self.num_classes = np.max(self.y_train) + 1
tokenizer = tf.keras.preprocessing.text.Tokenizer(num_words=self.max_words)
self.x_train = tokenizer.sequences_to_matrix(self.x_train, mode='binary')
self.y_train = tf.keras.utils.to_categorical(self.y_train, self.num_classes)
Reported by Pylint.
Line: 35
Column: 1
self.max_words = 1000
(self.x_train, self.y_train), _ = tf.keras.datasets.reuters.load_data(
num_words=self.max_words)
self.num_classes = np.max(self.y_train) + 1
tokenizer = tf.keras.preprocessing.text.Tokenizer(num_words=self.max_words)
self.x_train = tokenizer.sequences_to_matrix(self.x_train, mode='binary')
self.y_train = tf.keras.utils.to_categorical(self.y_train, self.num_classes)
self.epochs = 5
Reported by Pylint.
Line: 36
Column: 1
(self.x_train, self.y_train), _ = tf.keras.datasets.reuters.load_data(
num_words=self.max_words)
self.num_classes = np.max(self.y_train) + 1
tokenizer = tf.keras.preprocessing.text.Tokenizer(num_words=self.max_words)
self.x_train = tokenizer.sequences_to_matrix(self.x_train, mode='binary')
self.y_train = tf.keras.utils.to_categorical(self.y_train, self.num_classes)
self.epochs = 5
def _build_model(self):
Reported by Pylint.
keras/tests/tracking_util_xla_test.py
51 issues
Line: 16
Column: 1
# limitations under the License.
# ==============================================================================
from tensorflow.compiler.tests import xla_test
import tensorflow.compat.v2 as tf
from keras.engine import training
from keras.layers import core
from keras.optimizer_v2 import adam
Reported by Pylint.
Line: 18
Column: 1
from tensorflow.compiler.tests import xla_test
import tensorflow.compat.v2 as tf
from keras.engine import training
from keras.layers import core
from keras.optimizer_v2 import adam
from tensorflow.python.training.tracking import util as trackable_utils
Reported by Pylint.
Line: 19
Column: 1
from tensorflow.compiler.tests import xla_test
import tensorflow.compat.v2 as tf
from keras.engine import training
from keras.layers import core
from keras.optimizer_v2 import adam
from tensorflow.python.training.tracking import util as trackable_utils
Reported by Pylint.
Line: 20
Column: 1
import tensorflow.compat.v2 as tf
from keras.engine import training
from keras.layers import core
from keras.optimizer_v2 import adam
from tensorflow.python.training.tracking import util as trackable_utils
class NonLayerTrackable(tf.Module):
Reported by Pylint.
Line: 21
Column: 1
import tensorflow.compat.v2 as tf
from keras.engine import training
from keras.layers import core
from keras.optimizer_v2 import adam
from tensorflow.python.training.tracking import util as trackable_utils
class NonLayerTrackable(tf.Module):
Reported by Pylint.
Line: 22
Column: 1
from keras.engine import training
from keras.layers import core
from keras.optimizer_v2 import adam
from tensorflow.python.training.tracking import util as trackable_utils
class NonLayerTrackable(tf.Module):
def __init__(self):
Reported by Pylint.
Line: 1
Column: 1
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
Reported by Pylint.
Line: 22
Column: 1
from keras.engine import training
from keras.layers import core
from keras.optimizer_v2 import adam
from tensorflow.python.training.tracking import util as trackable_utils
class NonLayerTrackable(tf.Module):
def __init__(self):
Reported by Pylint.
Line: 25
Column: 1
from tensorflow.python.training.tracking import util as trackable_utils
class NonLayerTrackable(tf.Module):
def __init__(self):
super(NonLayerTrackable, self).__init__()
self.a_variable = trackable_utils.add_variable(
self, name="a_variable", shape=[])
Reported by Pylint.
Line: 25
Column: 1
from tensorflow.python.training.tracking import util as trackable_utils
class NonLayerTrackable(tf.Module):
def __init__(self):
super(NonLayerTrackable, self).__init__()
self.a_variable = trackable_utils.add_variable(
self, name="a_variable", shape=[])
Reported by Pylint.
keras/benchmarks/keras_examples_benchmarks/mnist_hierarchical_rnn_benchmark_test.py
50 issues
Line: 20
Column: 1
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from keras.benchmarks import benchmark_util
class HierarchicalRNNBenchmark(tf.test.Benchmark):
Reported by Pylint.
Line: 22
Column: 1
import tensorflow as tf
from keras.benchmarks import benchmark_util
class HierarchicalRNNBenchmark(tf.test.Benchmark):
"""Benchmarks for Hierarchical RNN using `tf.test.Benchmark`."""
Reported by Pylint.
Line: 26
Column: 1
class HierarchicalRNNBenchmark(tf.test.Benchmark):
"""Benchmarks for Hierarchical RNN using `tf.test.Benchmark`."""
def __init__(self):
super(HierarchicalRNNBenchmark, self).__init__()
self.num_classes = 10
self.row_hidden, self.col_hidden = 128, 128
Reported by Pylint.
Line: 28
Column: 1
class HierarchicalRNNBenchmark(tf.test.Benchmark):
"""Benchmarks for Hierarchical RNN using `tf.test.Benchmark`."""
def __init__(self):
super(HierarchicalRNNBenchmark, self).__init__()
self.num_classes = 10
self.row_hidden, self.col_hidden = 128, 128
(self.x_train, self.y_train), _ = tf.keras.datasets.mnist.load_data()
self.x_train = self.x_train.reshape(self.x_train.shape[0], 28, 28, 1)
Reported by Pylint.
Line: 29
Column: 1
"""Benchmarks for Hierarchical RNN using `tf.test.Benchmark`."""
def __init__(self):
super(HierarchicalRNNBenchmark, self).__init__()
self.num_classes = 10
self.row_hidden, self.col_hidden = 128, 128
(self.x_train, self.y_train), _ = tf.keras.datasets.mnist.load_data()
self.x_train = self.x_train.reshape(self.x_train.shape[0], 28, 28, 1)
self.x_train = self.x_train.astype('float32') / 255
Reported by Pylint.
Line: 29
Column: 5
"""Benchmarks for Hierarchical RNN using `tf.test.Benchmark`."""
def __init__(self):
super(HierarchicalRNNBenchmark, self).__init__()
self.num_classes = 10
self.row_hidden, self.col_hidden = 128, 128
(self.x_train, self.y_train), _ = tf.keras.datasets.mnist.load_data()
self.x_train = self.x_train.reshape(self.x_train.shape[0], 28, 28, 1)
self.x_train = self.x_train.astype('float32') / 255
Reported by Pylint.
Line: 30
Column: 1
def __init__(self):
super(HierarchicalRNNBenchmark, self).__init__()
self.num_classes = 10
self.row_hidden, self.col_hidden = 128, 128
(self.x_train, self.y_train), _ = tf.keras.datasets.mnist.load_data()
self.x_train = self.x_train.reshape(self.x_train.shape[0], 28, 28, 1)
self.x_train = self.x_train.astype('float32') / 255
self.y_train = tf.keras.utils.to_categorical(self.y_train, self.num_classes)
Reported by Pylint.
Line: 31
Column: 1
def __init__(self):
super(HierarchicalRNNBenchmark, self).__init__()
self.num_classes = 10
self.row_hidden, self.col_hidden = 128, 128
(self.x_train, self.y_train), _ = tf.keras.datasets.mnist.load_data()
self.x_train = self.x_train.reshape(self.x_train.shape[0], 28, 28, 1)
self.x_train = self.x_train.astype('float32') / 255
self.y_train = tf.keras.utils.to_categorical(self.y_train, self.num_classes)
Reported by Pylint.
Line: 32
Column: 1
super(HierarchicalRNNBenchmark, self).__init__()
self.num_classes = 10
self.row_hidden, self.col_hidden = 128, 128
(self.x_train, self.y_train), _ = tf.keras.datasets.mnist.load_data()
self.x_train = self.x_train.reshape(self.x_train.shape[0], 28, 28, 1)
self.x_train = self.x_train.astype('float32') / 255
self.y_train = tf.keras.utils.to_categorical(self.y_train, self.num_classes)
def _build_model(self):
Reported by Pylint.
Line: 33
Column: 1
self.num_classes = 10
self.row_hidden, self.col_hidden = 128, 128
(self.x_train, self.y_train), _ = tf.keras.datasets.mnist.load_data()
self.x_train = self.x_train.reshape(self.x_train.shape[0], 28, 28, 1)
self.x_train = self.x_train.astype('float32') / 255
self.y_train = tf.keras.utils.to_categorical(self.y_train, self.num_classes)
def _build_model(self):
"""Model from https://github.com/keras-team/keras/blob/master/examples
Reported by Pylint.
keras/datasets/reuters.py
50 issues
Line: 23
Column: 1
from keras.preprocessing.sequence import _remove_long_seq
from keras.utils.data_utils import get_file
from tensorflow.python.platform import tf_logging as logging
from tensorflow.python.util.tf_export import keras_export
@keras_export('keras.datasets.reuters.load_data')
def load_data(path='reuters.npz',
Reported by Pylint.
Line: 24
Column: 1
from keras.preprocessing.sequence import _remove_long_seq
from keras.utils.data_utils import get_file
from tensorflow.python.platform import tf_logging as logging
from tensorflow.python.util.tf_export import keras_export
@keras_export('keras.datasets.reuters.load_data')
def load_data(path='reuters.npz',
num_words=None,
Reported by Pylint.
Line: 117
Column: 9
with np.load(path, allow_pickle=True) as f: # pylint: disable=unexpected-keyword-arg
xs, labels = f['x'], f['y']
rng = np.random.RandomState(seed)
indices = np.arange(len(xs))
rng.shuffle(indices)
xs = xs[indices]
labels = labels[indices]
Reported by Pylint.
Line: 28
Column: 1
@keras_export('keras.datasets.reuters.load_data')
def load_data(path='reuters.npz',
num_words=None,
skip_top=0,
maxlen=None,
test_split=0.2,
seed=113,
Reported by Pylint.
Line: 28
Column: 1
@keras_export('keras.datasets.reuters.load_data')
def load_data(path='reuters.npz',
num_words=None,
skip_top=0,
maxlen=None,
test_split=0.2,
seed=113,
Reported by Pylint.
Line: 38
Column: 1
oov_char=2,
index_from=3,
**kwargs):
"""Loads the Reuters newswire classification dataset.
This is a dataset of 11,228 newswires from Reuters, labeled over 46 topics.
This was originally generated by parsing and preprocessing the classic
Reuters-21578 dataset, but the preprocessing code is no longer packaged
Reported by Pylint.
Line: 101
Column: 1
have simply been skipped.
"""
# Legacy support
if 'nb_words' in kwargs:
logging.warning('The `nb_words` argument in `load_data` '
'has been renamed `num_words`.')
num_words = kwargs.pop('nb_words')
if kwargs:
raise TypeError(f'Unrecognized keyword arguments: {str(kwargs)}')
Reported by Pylint.
Line: 102
Column: 1
"""
# Legacy support
if 'nb_words' in kwargs:
logging.warning('The `nb_words` argument in `load_data` '
'has been renamed `num_words`.')
num_words = kwargs.pop('nb_words')
if kwargs:
raise TypeError(f'Unrecognized keyword arguments: {str(kwargs)}')
Reported by Pylint.
Line: 104
Column: 1
if 'nb_words' in kwargs:
logging.warning('The `nb_words` argument in `load_data` '
'has been renamed `num_words`.')
num_words = kwargs.pop('nb_words')
if kwargs:
raise TypeError(f'Unrecognized keyword arguments: {str(kwargs)}')
origin_folder = 'https://storage.googleapis.com/tensorflow/tf-keras-datasets/'
path = get_file(
Reported by Pylint.
Line: 105
Column: 1
logging.warning('The `nb_words` argument in `load_data` '
'has been renamed `num_words`.')
num_words = kwargs.pop('nb_words')
if kwargs:
raise TypeError(f'Unrecognized keyword arguments: {str(kwargs)}')
origin_folder = 'https://storage.googleapis.com/tensorflow/tf-keras-datasets/'
path = get_file(
path,
Reported by Pylint.
keras/optimizer_v2/adadelta.py
50 issues
Line: 17
Column: 1
# ==============================================================================
"""Adadelta optimizer implementation."""
import tensorflow.compat.v2 as tf
# pylint: disable=g-classes-have-attributes
import numpy as np
from keras import backend_config
from keras.optimizer_v2 import optimizer_v2
Reported by Pylint.
Line: 18
Column: 1
"""Adadelta optimizer implementation."""
import tensorflow.compat.v2 as tf
# pylint: disable=g-classes-have-attributes
import numpy as np
from keras import backend_config
from keras.optimizer_v2 import optimizer_v2
from tensorflow.python.util.tf_export import keras_export
Reported by Pylint.
Line: 21
Column: 1
# pylint: disable=g-classes-have-attributes
import numpy as np
from keras import backend_config
from keras.optimizer_v2 import optimizer_v2
from tensorflow.python.util.tf_export import keras_export
@keras_export('keras.optimizers.Adadelta')
Reported by Pylint.
Line: 22
Column: 1
import numpy as np
from keras import backend_config
from keras.optimizer_v2 import optimizer_v2
from tensorflow.python.util.tf_export import keras_export
@keras_export('keras.optimizers.Adadelta')
class Adadelta(optimizer_v2.OptimizerV2):
Reported by Pylint.
Line: 23
Column: 1
import numpy as np
from keras import backend_config
from keras.optimizer_v2 import optimizer_v2
from tensorflow.python.util.tf_export import keras_export
@keras_export('keras.optimizers.Adadelta')
class Adadelta(optimizer_v2.OptimizerV2):
r"""Optimizer that implements the Adadelta algorithm.
Reported by Pylint.
Line: 28
Column: 1
@keras_export('keras.optimizers.Adadelta')
class Adadelta(optimizer_v2.OptimizerV2):
r"""Optimizer that implements the Adadelta algorithm.
Adadelta optimization is a stochastic gradient descent method that is based on
adaptive learning rate per dimension to address two drawbacks:
- The continual decay of learning rates throughout training.
Reported by Pylint.
Line: 66
Column: 1
- [Zeiler, 2012](http://arxiv.org/abs/1212.5701)
"""
_HAS_AGGREGATE_GRAD = True
def __init__(self,
learning_rate=0.001,
rho=0.95,
epsilon=1e-7,
Reported by Pylint.
Line: 68
Column: 1
_HAS_AGGREGATE_GRAD = True
def __init__(self,
learning_rate=0.001,
rho=0.95,
epsilon=1e-7,
name='Adadelta',
**kwargs):
Reported by Pylint.
Line: 74
Column: 5
epsilon=1e-7,
name='Adadelta',
**kwargs):
super(Adadelta, self).__init__(name, **kwargs)
self._set_hyper('learning_rate', kwargs.get('lr', learning_rate))
self._set_hyper('decay', self._initial_decay)
self._set_hyper('rho', rho)
self.epsilon = epsilon or backend_config.epsilon()
Reported by Pylint.
Line: 74
Column: 1
epsilon=1e-7,
name='Adadelta',
**kwargs):
super(Adadelta, self).__init__(name, **kwargs)
self._set_hyper('learning_rate', kwargs.get('lr', learning_rate))
self._set_hyper('decay', self._initial_decay)
self._set_hyper('rho', rho)
self.epsilon = epsilon or backend_config.epsilon()
Reported by Pylint.
keras/layers/rnn_cell_wrapper_v2.py
50 issues
Line: 27
Column: 1
from keras.layers import recurrent
from keras.layers.legacy_rnn import rnn_cell_wrapper_impl
from keras.utils import tf_inspect
from tensorflow.python.util.tf_export import tf_export
class _RNNCellWrapperV2(recurrent.AbstractRNNCell):
"""Base class for cells wrappers V2 compatibility.
Reported by Pylint.
Line: 88
Column: 1
@classmethod
def from_config(cls, config, custom_objects=None):
config = config.copy()
from keras.layers.serialization import deserialize as deserialize_layer # pylint: disable=g-import-not-at-top
cell = deserialize_layer(config.pop("cell"), custom_objects=custom_objects)
return cls(cell, **config)
@tf_export("nn.RNNCellDropoutWrapper", v1=[])
Reported by Pylint.
Line: 30
Column: 1
from tensorflow.python.util.tf_export import tf_export
class _RNNCellWrapperV2(recurrent.AbstractRNNCell):
"""Base class for cells wrappers V2 compatibility.
This class along with `rnn_cell_impl._RNNCellWrapperV1` allows to define
wrappers that are compatible with V1 and V2, and defines helper methods for
this purpose.
Reported by Pylint.
Line: 30
Column: 1
from tensorflow.python.util.tf_export import tf_export
class _RNNCellWrapperV2(recurrent.AbstractRNNCell):
"""Base class for cells wrappers V2 compatibility.
This class along with `rnn_cell_impl._RNNCellWrapperV1` allows to define
wrappers that are compatible with V1 and V2, and defines helper methods for
this purpose.
Reported by Pylint.
Line: 46
Column: 3
cell_call_spec.varkw is not None
)
def call(self, inputs, state, **kwargs):
"""Runs the RNN cell step computation.
When `call` is being used, we assume that the wrapper object has been built,
and therefore the wrapped cells has been built via its `build` method and
its `call` method can be used directly.
Reported by Pylint.
Line: 70
Column: 3
return self._call_wrapped_cell(
inputs, state, cell_call_fn=self.cell.call, **kwargs)
def build(self, inputs_shape):
"""Builds the wrapped cell."""
self.cell.build(inputs_shape)
self.built = True
def get_config(self):
Reported by Pylint.
Line: 86
Column: 3
return dict(list(base_config.items()) + list(config.items()))
@classmethod
def from_config(cls, config, custom_objects=None):
config = config.copy()
from keras.layers.serialization import deserialize as deserialize_layer # pylint: disable=g-import-not-at-top
cell = deserialize_layer(config.pop("cell"), custom_objects=custom_objects)
return cls(cell, **config)
Reported by Pylint.
Line: 31
Column: 1
class _RNNCellWrapperV2(recurrent.AbstractRNNCell):
"""Base class for cells wrappers V2 compatibility.
This class along with `rnn_cell_impl._RNNCellWrapperV1` allows to define
wrappers that are compatible with V1 and V2, and defines helper methods for
this purpose.
"""
Reported by Pylint.
Line: 38
Column: 1
this purpose.
"""
def __init__(self, cell, *args, **kwargs):
super(_RNNCellWrapperV2, self).__init__(*args, **kwargs)
self.cell = cell
cell_call_spec = tf_inspect.getfullargspec(cell.call)
self._expects_training_arg = ("training" in cell_call_spec.args) or (
cell_call_spec.varkw is not None
Reported by Pylint.
Line: 39
Column: 5
"""
def __init__(self, cell, *args, **kwargs):
super(_RNNCellWrapperV2, self).__init__(*args, **kwargs)
self.cell = cell
cell_call_spec = tf_inspect.getfullargspec(cell.call)
self._expects_training_arg = ("training" in cell_call_spec.args) or (
cell_call_spec.varkw is not None
)
Reported by Pylint.
keras/integration_test/central_storage_strategy_test.py
49 issues
Line: 17
Column: 1
# ==============================================================================
"""Tests for KPL + CentralStorageStrategy."""
from absl.testing import parameterized
import tensorflow as tf
from tensorflow.python.distribute import combinations as ds_combinations
from tensorflow.python.distribute import strategy_combinations
from tensorflow.python.framework import test_combinations as combinations
Reported by Pylint.
Line: 18
Column: 1
"""Tests for KPL + CentralStorageStrategy."""
from absl.testing import parameterized
import tensorflow as tf
from tensorflow.python.distribute import combinations as ds_combinations
from tensorflow.python.distribute import strategy_combinations
from tensorflow.python.framework import test_combinations as combinations
from tensorflow.python.keras.utils import kpl_test_utils
Reported by Pylint.
Line: 20
Column: 1
from absl.testing import parameterized
import tensorflow as tf
from tensorflow.python.distribute import combinations as ds_combinations
from tensorflow.python.distribute import strategy_combinations
from tensorflow.python.framework import test_combinations as combinations
from tensorflow.python.keras.utils import kpl_test_utils
Reported by Pylint.
Line: 21
Column: 1
import tensorflow as tf
from tensorflow.python.distribute import combinations as ds_combinations
from tensorflow.python.distribute import strategy_combinations
from tensorflow.python.framework import test_combinations as combinations
from tensorflow.python.keras.utils import kpl_test_utils
# TODO(b/182278926): Combine this test with other strategies.
Reported by Pylint.
Line: 22
Column: 1
from tensorflow.python.distribute import combinations as ds_combinations
from tensorflow.python.distribute import strategy_combinations
from tensorflow.python.framework import test_combinations as combinations
from tensorflow.python.keras.utils import kpl_test_utils
# TODO(b/182278926): Combine this test with other strategies.
@ds_combinations.generate(
Reported by Pylint.
Line: 23
Column: 1
from tensorflow.python.distribute import combinations as ds_combinations
from tensorflow.python.distribute import strategy_combinations
from tensorflow.python.framework import test_combinations as combinations
from tensorflow.python.keras.utils import kpl_test_utils
# TODO(b/182278926): Combine this test with other strategies.
@ds_combinations.generate(
combinations.combine(
Reported by Pylint.
Line: 26
Column: 3
from tensorflow.python.keras.utils import kpl_test_utils
# TODO(b/182278926): Combine this test with other strategies.
@ds_combinations.generate(
combinations.combine(
distribution=[
strategy_combinations.central_storage_strategy_with_gpu_and_cpu,
],
Reported by Pylint.
Line: 33
Column: 1
strategy_combinations.central_storage_strategy_with_gpu_and_cpu,
],
mode=["eager"]))
class CentralStorageStrategyTest(tf.test.TestCase, parameterized.TestCase):
def testTrainAndServeWithKPL(self, distribution):
use_adapt = False
test_utils_obj = kpl_test_utils.DistributeKplTestUtils()
with distribution.scope():
Reported by Pylint.
Line: 33
Column: 1
strategy_combinations.central_storage_strategy_with_gpu_and_cpu,
],
mode=["eager"]))
class CentralStorageStrategyTest(tf.test.TestCase, parameterized.TestCase):
def testTrainAndServeWithKPL(self, distribution):
use_adapt = False
test_utils_obj = kpl_test_utils.DistributeKplTestUtils()
with distribution.scope():
Reported by Pylint.
Line: 35
Column: 1
mode=["eager"]))
class CentralStorageStrategyTest(tf.test.TestCase, parameterized.TestCase):
def testTrainAndServeWithKPL(self, distribution):
use_adapt = False
test_utils_obj = kpl_test_utils.DistributeKplTestUtils()
with distribution.scope():
feature_mapper, label_mapper = test_utils_obj.define_kpls_for_training(
use_adapt)
Reported by Pylint.
keras/benchmarks/keras_examples_benchmarks/mnist_irnn_benchmark_test.py
49 issues
Line: 20
Column: 1
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from keras.benchmarks import benchmark_util
class IRNNMnistBenchmark(tf.test.Benchmark):
Reported by Pylint.
Line: 22
Column: 1
import tensorflow as tf
from keras.benchmarks import benchmark_util
class IRNNMnistBenchmark(tf.test.Benchmark):
"""Benchmarks for IRNN using `tf.test.Benchmark`."""
Reported by Pylint.
Line: 26
Column: 1
class IRNNMnistBenchmark(tf.test.Benchmark):
"""Benchmarks for IRNN using `tf.test.Benchmark`."""
def __init__(self):
super(IRNNMnistBenchmark, self).__init__()
self.num_classes = 10
self.hidden_units = 100
Reported by Pylint.
Line: 28
Column: 1
class IRNNMnistBenchmark(tf.test.Benchmark):
"""Benchmarks for IRNN using `tf.test.Benchmark`."""
def __init__(self):
super(IRNNMnistBenchmark, self).__init__()
self.num_classes = 10
self.hidden_units = 100
self.learning_rate = 1e-6
(self.x_train, self.y_train), _ = tf.keras.datasets.mnist.load_data()
Reported by Pylint.
Line: 29
Column: 1
"""Benchmarks for IRNN using `tf.test.Benchmark`."""
def __init__(self):
super(IRNNMnistBenchmark, self).__init__()
self.num_classes = 10
self.hidden_units = 100
self.learning_rate = 1e-6
(self.x_train, self.y_train), _ = tf.keras.datasets.mnist.load_data()
self.x_train = self.x_train.reshape(self.x_train.shape[0], -1, 1)
Reported by Pylint.
Line: 29
Column: 5
"""Benchmarks for IRNN using `tf.test.Benchmark`."""
def __init__(self):
super(IRNNMnistBenchmark, self).__init__()
self.num_classes = 10
self.hidden_units = 100
self.learning_rate = 1e-6
(self.x_train, self.y_train), _ = tf.keras.datasets.mnist.load_data()
self.x_train = self.x_train.reshape(self.x_train.shape[0], -1, 1)
Reported by Pylint.
Line: 30
Column: 1
def __init__(self):
super(IRNNMnistBenchmark, self).__init__()
self.num_classes = 10
self.hidden_units = 100
self.learning_rate = 1e-6
(self.x_train, self.y_train), _ = tf.keras.datasets.mnist.load_data()
self.x_train = self.x_train.reshape(self.x_train.shape[0], -1, 1)
self.x_train = self.x_train.astype('float32') / 255
Reported by Pylint.
Line: 31
Column: 1
def __init__(self):
super(IRNNMnistBenchmark, self).__init__()
self.num_classes = 10
self.hidden_units = 100
self.learning_rate = 1e-6
(self.x_train, self.y_train), _ = tf.keras.datasets.mnist.load_data()
self.x_train = self.x_train.reshape(self.x_train.shape[0], -1, 1)
self.x_train = self.x_train.astype('float32') / 255
self.y_train = tf.keras.utils.to_categorical(self.y_train, self.num_classes)
Reported by Pylint.
Line: 32
Column: 1
super(IRNNMnistBenchmark, self).__init__()
self.num_classes = 10
self.hidden_units = 100
self.learning_rate = 1e-6
(self.x_train, self.y_train), _ = tf.keras.datasets.mnist.load_data()
self.x_train = self.x_train.reshape(self.x_train.shape[0], -1, 1)
self.x_train = self.x_train.astype('float32') / 255
self.y_train = tf.keras.utils.to_categorical(self.y_train, self.num_classes)
Reported by Pylint.
Line: 33
Column: 1
self.num_classes = 10
self.hidden_units = 100
self.learning_rate = 1e-6
(self.x_train, self.y_train), _ = tf.keras.datasets.mnist.load_data()
self.x_train = self.x_train.reshape(self.x_train.shape[0], -1, 1)
self.x_train = self.x_train.astype('float32') / 255
self.y_train = tf.keras.utils.to_categorical(self.y_train, self.num_classes)
def _build_model(self):
Reported by Pylint.