https://github.com/GPflow/GPflow
Revision f8ee093244ad3a1666d282ca5bb1c26c8768a175 authored by Vincent Dutordoir on 26 February 2020, 09:52:47 UTC, committed by GitHub on 26 February 2020, 09:52:47 UTC
GPflow makes use of a multipledispatch Dispatcher that internally uses a generator.  However, according to TensorFlow [Capabilities and Limitations](https://github.com/tensorflow/tensorflow/blob/560e2575ecad30bedff5b192f33f6d06b19ccaeb/tensorflow/python/autograph/LIMITATIONS.md) generators are not supported by AutoGraph and probably will never be. Thus, compiling code that passed though the dispatcher led to the following warnings:
```bash
WARNING:tensorflow:Entity <bound method Dispatcher.dispatch_iter of <dispatched sample_conditional>> appears to be a generator function. It will not be converted by AutoGraph.
WARNING: Entity <bound method Dispatcher.dispatch_iter of <dispatched sample_conditional>> appears to be a generator function. It will not be converted by AutoGraph.
WARNING:tensorflow:Entity <bound method Dispatcher.dispatch_iter of <dispatched conditional>> appears to be a generator function. It will not be converted by AutoGraph.
WARNING: Entity <bound method Dispatcher.dispatch_iter of <dispatched conditional>> appears to be a generator function. It will not be converted by AutoGraph.
```

This PR still uses the same dispatcher, but overwrites the problematic method that uses python generators and replaces it by a simple list.


### NOTE
As of this PR we do not need to write `autograph=False` in `tf.function` anymore, and all the code inside dispatching gets compiled the same way as everything else :) !
1 parent 002b217
Raw File
Tip revision: f8ee093244ad3a1666d282ca5bb1c26c8768a175 authored by Vincent Dutordoir on 26 February 2020, 09:52:47 UTC
Remove the use of generator in dispatcher (#1264)
Tip revision: f8ee093
.gitignore
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Emacs backups
*~

# Pycharm IDE directory
.idea

# IPython Notebooks
.ipynb_checkpoints

# VSCode
.vscode

# OSX
.DS_Store
back to top