Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eager: Warn with invalid policy #14739

Closed
malmaud opened this issue Nov 21, 2017 · 2 comments
Closed

Eager: Warn with invalid policy #14739

malmaud opened this issue Nov 21, 2017 · 2 comments
Assignees
Labels

Comments

@malmaud
Copy link
Contributor

malmaud commented Nov 21, 2017

If a user accidentally writes tfe.enable_eager_execution(tfe.DEVICE_PLACEMENT_WARN) instead of the correct tfe.enable_eager_execution(device_policy=tfe.DEVICE_PLACEMENT_WARN), they won't get an error until later in their program.

For example, tfe.num_gpus() after the incorrect enable call produces

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-8-71d6509178f5> in <module>()
----> 1 tfe.num_gpus()

~/anaconda3/lib/python3.6/site-packages/tensorflow/python/eager/context.py in num_gpus()
    458     The number of available GPU devices.
    459   """
--> 460   return context().num_gpus()

~/anaconda3/lib/python3.6/site-packages/tensorflow/python/eager/context.py in num_gpus(self)
    286   def num_gpus(self):
    287     """The number of GPUs available to execute operations."""
--> 288     self._initialize_handle_and_devices()
    289     return self._num_gpus
    290 

~/anaconda3/lib/python3.6/site-packages/tensorflow/python/eager/context.py in _initialize_handle_and_devices(self)
    121         with errors.raise_exception_on_not_ok_status() as status:
    122           if self._config is not None:
--> 123             config_str = self._config.SerializeToString()
    124             pywrap_tensorflow.TFE_ContextOptionsSetConfig(
    125                 opts, config_str, len(config_str), status)

AttributeError: 'int' object has no attribute 'SerializeToString'

I'd think it makes more sense to throw an error immediately after the incorrect enable_eager_execution.

This is on master (ab00df9).

@shivaniag shivaniag added type:bug Bug stat:awaiting tensorflower Status - Awaiting response from tensorflower labels Nov 25, 2017
@shivaniag
Copy link
Contributor

@asimshankar could you please take a look into this.

@asimshankar
Copy link
Contributor

Sounds like a fair request :), will send out a change to address this.

@shivaniag shivaniag added stat:awaiting tensorflower Status - Awaiting response from tensorflower and removed stat:awaiting tensorflower Status - Awaiting response from tensorflower labels Nov 28, 2017
sb2nov pushed a commit to sb2nov/tensorflow that referenced this issue Dec 1, 2017
@sb2nov sb2nov closed this as completed in ba87a80 Dec 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants