Ejemplo n.º 1
0
    def testBuildDocs(self):
        if sys.version_info >= (3, 0):
            print('Warning: Doc generation is not supported from python3.')
            return

        doc_generator = generate_lib.DocGenerator()

        doc_generator.set_py_modules([('tf', tf), ('tfdbg', tf_debug)])

        try:
            status = doc_generator.build(Flags())
        except RuntimeError as e:
            if not e.args[0].startswith('Modules nested too deep'):
                raise

            msg = textwrap.dedent("""\
          %s

          ****************************************************************
          If this test fails here, you have most likely introduced an
          unsealed module. Make sure to use `remove_undocumented` or similar
          utilities to avoid leaking symbols. See above for more information
          on the exact point of failure.
          ****************************************************************
          """ % e.args[0])

            raise RuntimeError(msg)

        if status:
            self.fail('Found %s Errors!' % status)
Ejemplo n.º 2
0
    def testBuildDocs(self):
        doc_generator = generate_lib.DocGenerator()

        doc_generator.set_py_modules([('tf', tf), ('tfdbg', tf_debug)])

        status = doc_generator.build(Flags())

        if status:
            self.fail('Found %s Errors!' % status)
Ejemplo n.º 3
0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os
import sys

import tensorflow as tf

from tensorflow.python import debug as tf_debug
from tensorflow.python.util import tf_inspect
from tensorflow.tools.docs import generate_lib

if __name__ == '__main__':
    doc_generator = generate_lib.DocGenerator()
    doc_generator.add_output_dir_argument()
    doc_generator.add_src_dir_argument()

    # This doc generator works on the TensorFlow codebase. Since this script lives
    # at tensorflow/tools/docs, and all code is defined somewhere inside
    # tensorflow/, we can compute the base directory (two levels up), which is
    # valid unless we're trying to apply this to a different code base, or are
    # moving the script around.
    script_dir = os.path.dirname(tf_inspect.getfile(tf_inspect.currentframe()))
    default_base_dir = os.path.join(script_dir, '..', '..')
    doc_generator.add_base_dir_argument(default_base_dir)

    flags = doc_generator.parse_known_args()

    # tf_debug is not imported with tf, it's a separate module altogether