Skip to content

Conversation

karmel
Copy link
Contributor

@karmel karmel commented Mar 19, 2018

So much linting. Please don't introduce any new lint errors after this. Tests will be updated to check as well.

@karmel
Copy link
Contributor Author

karmel commented Mar 19, 2018

In the interest of sharing the pain-- everyone look over the files you touched recently.

LoggingTensorHook, ProfilerHook, ExamplesPerSecondHook, which are defined
as keys in HOOKS
kwargs: a dictionary of arguments to the hooks.
**kwargs: a dictionary of arguments to the hooks.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seems silly in the Args, but glint complains otherwise.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I got the same warning when glinting it . Will follow this style later. LGTM, thanks.

Copy link
Contributor

@k-w-w k-w-w left a comment

Choose a reason for hiding this comment

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

Wow, that's a lot of lint. Thanks for cleaning all the code!

`method` and other details each time.
"""Simple wrapper around tf.resize_images.
This is primarily to make sure we use the same `method` and other details
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: replace method with ResizeMethod

data_format: The input format ('channels_last' or 'channels_first').
Returns:
The output tensor of the block.
Copy link
Contributor

Choose a reason for hiding this comment

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

  • comment that the output shape should be the same as the inputs

with tf.gfile.Open(filename, 'rb') as f:
magic = read32(f)
num_images = read32(f)
num_images = read32(f) # pylint: disable=unused-variable
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be better to write this as:

read32(f) # num_images, ignored

And same for num_items below?

Copy link
Contributor

@yhliang2018 yhliang2018 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

Copy link
Contributor

@robieta robieta left a comment

Choose a reason for hiding this comment

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

LGTM.

with tf.gfile.Open(filename, 'rb') as f:
magic = read32(f)
num_items = read32(f)
num_items = read32(f) # pylint: disable=unused-variable
Copy link
Member

Choose a reason for hiding this comment

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

I think instead of put a suppression of lint here, you can just rename the variable as unused_num_items and I think it will make the code more readable, and also make the lint warning go away.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Solved slightly differently, as per @asimshankar 's comments above.

ValueError: if no GPUs are found, or selected batch_size is invalid.
"""
from tensorflow.python.client import device_lib
from tensorflow.python.client import device_lib # pylint: disable=g-import-not-at-top
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason that we have to do a local import and not put it on top?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We want to hide this code, as it should not be exposed to the user, and we want to remove it as soon as it's done by Estimator directly. So, for now, leaving bundled.

from official.mnist import dataset as mnist_dataset
from official.mnist import mnist
from official.mnist import dataset

Copy link
Member

Choose a reason for hiding this comment

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

I think glint will give u a snippet to paste for incorrect order, should we do that instead of put a lint suppression here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem is TF versus official; alphabetically TF should come after official, and to Google, their both the same, but for us, TF is third party.

Copy link
Contributor

@k-w-w k-w-w left a comment

Choose a reason for hiding this comment

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

Just one nit!


_NUM_EXAMPLES = {
'train': 32561,
'validation': 16281,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove extra space

@karmel
Copy link
Contributor Author

karmel commented Mar 20, 2018

I added an rcfile that we will be able to run with pylint:

RCFILE="utils/testing/pylint.rcfile"

for file in `find . -name '*.py' ! -name '*test.py' -print`
do
  echo "Linting ${file}"
  pylint --rcfile=$RCFILE $file
done

# More lenient for test files.
for file in `find . -name '*test.py' -print`
do
  echo "Linting ${file}"
  pylint --rcfile=$RCFILE --disable=missing-docstring,protected-access $file
done

@karmel karmel merged commit 7cfb6bb into master Mar 20, 2018
@karmel karmel deleted the fix/glint branch March 20, 2018 20:10
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.

8 participants