Skip to content

layers.py from keras#12

Open
ghost wants to merge 1 commit intomasterfrom
python_keras_layers
Open

layers.py from keras#12
ghost wants to merge 1 commit intomasterfrom
python_keras_layers

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Jan 12, 2020

This pull request is a copy of /keras/legacy/layers.py from keras-team/keras

Copy link
Copy Markdown

@monocodus monocodus Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is autogenerated code-style review, new suggestions: 6

Comment thread layers.py
kwargs['initial_state'] = initial_state
return super(Recurrent, self).__call__(inputs, **kwargs)

def call(self, inputs, mask=None, training=None, initial_state=None):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is too long

call( self , inputs , mask = None , training = None , initial_state = None ) now spans 58 lines.
Corresponding modifications started here.
Keep your functions' length within 50 lines to improve readability.

This comment was generated with the following checker: long_method

Comment thread layers.py
kwargs['initial_state'] = initial_state
return super(Recurrent, self).__call__(inputs, **kwargs)

def call(self, inputs, mask=None, training=None, initial_state=None):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is too complicated

call( self , inputs , mask = None , training = None , initial_state = None ) now has cyclomatic complexity of 13.
Corresponding modifications started here.
Split your routines to keep cyclomatic complexity below 10 to improve their maintainability.

This comment was generated with the following checker: high_cyclomatic_complexity

Comment thread layers.py
self.input_spec = [InputSpec(ndim=5)]
self.state_spec = None

def compute_output_shape(self, input_shape):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is too complicated

compute_output_shape( self , input_shape ) now has cyclomatic complexity of 12.
Corresponding modifications started here.
Split your routines to keep cyclomatic complexity below 10 to improve their maintainability.

This comment was generated with the following checker: high_cyclomatic_complexity

Comment thread layers.py
- [Maxout Networks](http://arxiv.org/abs/1302.4389)
"""

def __init__(self, output_dim,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function has too many parameters

__init__( self , output_dim , nb_feature = 4 , init = 'glorot_uniform' , weights = None , W_regularizer = None , b_regularizer = None , activity_regularizer = None , W_constraint = None , b_constraint = None , bias = True , input_dim = None , ** kwargs ) now has 13 parameters.
Functions with parameter list length above 5 are mostly hard to understand and use.
To reduce the number of arguments, you can isolate arguments used together into an object, or split the function

This comment was generated with the following checker: long_parameter_list

Comment thread layers.py
- [Highway Networks](http://arxiv.org/abs/1505.00387v2)
"""

def __init__(self,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function has too many parameters

__init__( self , init = 'glorot_uniform' , activation = None , weights = None , W_regularizer = None , b_regularizer = None , activity_regularizer = None , W_constraint = None , b_constraint = None , bias = True , input_dim = None , ** kwargs ) now has 12 parameters.
Functions with parameter list length above 5 are mostly hard to understand and use.
To reduce the number of arguments, you can isolate arguments used together into an object, or split the function

This comment was generated with the following checker: long_parameter_list

Comment thread layers.py
the initial state of the RNN layer.
"""

def __init__(self, return_sequences=False,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function has too many parameters

__init__( self , return_sequences = False , return_state = False , go_backwards = False , stateful = False , unroll = False , implementation = 0 , ** kwargs ) now has 8 parameters.
Functions with parameter list length above 5 are mostly hard to understand and use.
To reduce the number of arguments, you can isolate arguments used together into an object, or split the function

This comment was generated with the following checker: long_parameter_list

@ghost ghost added Demonstration Python Files in Python labels Jan 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants