diff --git a/docs/conf.py b/docs/conf.py
index be2e10f48ca71e6332c6ae97636321d6fa7eca7a..be1d9ae6aa14dab0664790112c8df8957fdd7682 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -18,6 +18,13 @@ import os
 import re
 import textwrap
 import logging
+import subprocess
+
+# Added by tim
+import keras  # to avoid "Using Tensorflow" message later
+if os.environ.get("READTHEDOCS"):
+    # For rtd builds, call "make generate" first.
+    subprocess.check_call("make generate", shell=True)
 
 # Hack added by tim for bug in autoprogram extension under Python 2.
 from sphinx.util.pycompat import indent  # pylint: disable=import-error