本文整理匯總了Python中tensorflow_docs.api_generator.generate_lib.DocGenerator方法的典型用法代碼示例。如果您正苦於以下問題:Python generate_lib.DocGenerator方法的具體用法?Python generate_lib.DocGenerator怎麽用?Python generate_lib.DocGenerator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tensorflow_docs.api_generator.generate_lib
的用法示例。
在下文中一共展示了generate_lib.DocGenerator方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: from tensorflow_docs.api_generator import generate_lib [as 別名]
# 或者: from tensorflow_docs.api_generator.generate_lib import DocGenerator [as 別名]
def main(_):
private_map = {
'tfl': ['python'],
'tfl.aggregation_layer': ['Aggregation'],
'tfl.categorical_calibration_layer': ['CategoricalCalibration'],
'tfl.lattice_layer': ['Lattice'],
'tfl.linear_layer': ['Linear'],
'tfl.pwl_calibration_layer': ['PWLCalibration'],
'tfl.parallel_combination_layer': ['ParallelCombination'],
'tfl.rtl_layer': ['RTL'],
}
doc_generator = generate_lib.DocGenerator(
root_title='TensorFlow Lattice 2.0',
py_modules=[('tfl', tfl)],
base_dir=os.path.dirname(tfl.__file__),
code_url_prefix=FLAGS.code_url_prefix,
search_hints=FLAGS.search_hints,
site_path=FLAGS.site_path,
private_map=private_map,
callbacks=[local_definitions_filter])
sys.exit(doc_generator.build(output_dir=FLAGS.output_dir))
示例2: main
# 需要導入模塊: from tensorflow_docs.api_generator import generate_lib [as 別名]
# 或者: from tensorflow_docs.api_generator.generate_lib import DocGenerator [as 別名]
def main(unused_argv):
doc_generator = generate_lib.DocGenerator(
root_title="OpenFermion",
py_modules=[("openfermion", openfermion)],
base_dir=os.path.dirname(openfermion.__file__),
code_url_prefix=FLAGS.code_url_prefix,
search_hints=FLAGS.search_hints,
site_path=FLAGS.site_path,
callbacks=[public_api.local_definitions_filter],
private_map={
# Module paths to skip when crawling source code.
# Example:
# "cirq.google.engine.client.quantum.QuantumEngineServiceClient":
# ["enums"]
})
doc_generator.build(output_dir=FLAGS.output_dir)
示例3: main
# 需要導入模塊: from tensorflow_docs.api_generator import generate_lib [as 別名]
# 或者: from tensorflow_docs.api_generator.generate_lib import DocGenerator [as 別名]
def main(argv):
if argv[1:]:
raise ValueError("Unrecognized arguments: {}".format(argv[1:]))
if FLAGS.code_url_prefix:
code_url_prefix = FLAGS.code_url_prefix
elif FLAGS.git_branch:
code_url_prefix = CODE_PREFIX_TEMPLATE.format(git_branch=FLAGS.git_branch)
else:
code_url_prefix = CODE_PREFIX_TEMPLATE.format(git_branch="master")
doc_generator = generate_lib.DocGenerator(
root_title=PROJECT_FULL_NAME,
py_modules=[(PROJECT_SHORT_NAME, tfa)],
code_url_prefix=code_url_prefix,
private_map={"tfa": ["__version__", "utils", "version"]},
# This callback usually cleans up a lot of aliases caused by internal imports.
callbacks=[public_api.local_definitions_filter],
search_hints=FLAGS.search_hints,
site_path=FLAGS.site_path,
)
doc_generator.build(FLAGS.output_dir)
print("Output docs to: ", FLAGS.output_dir)
示例4: main
# 需要導入模塊: from tensorflow_docs.api_generator import generate_lib [as 別名]
# 或者: from tensorflow_docs.api_generator.generate_lib import DocGenerator [as 別名]
def main(_):
do_not_generate_docs_for = []
for blocked_doc in do_not_generate_docs_for:
doc_controls.do_not_generate_docs(blocked_doc)
doc_generator = generate_lib.DocGenerator(
root_title="Neural Structured Learning",
py_modules=[("nsl", nsl)],
code_url_prefix=FLAGS.code_url_prefix,
search_hints=FLAGS.search_hints,
site_path=FLAGS.site_path,
# local_definitions_filter ensures that shared modules are only
# documented in the location that defines them, instead of every location
# that imports them.
callbacks=[public_api.local_definitions_filter])
doc_generator.build(output_dir=FLAGS.output_dir)
示例5: main
# 需要導入模塊: from tensorflow_docs.api_generator import generate_lib [as 別名]
# 或者: from tensorflow_docs.api_generator.generate_lib import DocGenerator [as 別名]
def main(unused_argv):
doc_generator = generate_lib.DocGenerator(
root_title="Cirq",
py_modules=[("cirq", cirq)],
base_dir=os.path.dirname(cirq.__file__),
code_url_prefix=FLAGS.code_url_prefix,
search_hints=FLAGS.search_hints,
site_path=FLAGS.site_path,
callbacks=[public_api.local_definitions_filter],
private_map={
# Opt to not build docs for these paths for now since they error.
"cirq.google.engine.client.quantum.QuantumEngineServiceClient":
["enums"],
"cirq.google.engine.client.quantum_v1alpha1.QuantumEngineServiceClient":
["enums"]
})
doc_generator.build(output_dir=FLAGS.output_dir)
示例6: main
# 需要導入模塊: from tensorflow_docs.api_generator import generate_lib [as 別名]
# 或者: from tensorflow_docs.api_generator.generate_lib import DocGenerator [as 別名]
def main(args):
if args[1:]:
raise ValueError('Unrecognized command line args', args[1:])
for obj in suppress_docs_for:
doc_controls.do_not_generate_docs(obj)
doc_generator = generate_lib.DocGenerator(
root_title='TensorFlow Model Analysis',
py_modules=[('tfma', tfma)],
base_dir=os.path.dirname(tfma.__file__),
code_url_prefix=FLAGS.code_url_prefix,
search_hints=FLAGS.search_hints,
site_path=FLAGS.site_path,
private_map={},
callbacks=[
public_api.local_definitions_filter, depth_filter, suppress_docs
])
return doc_generator.build(output_dir=FLAGS.output_dir)
示例7: main
# 需要導入模塊: from tensorflow_docs.api_generator import generate_lib [as 別名]
# 或者: from tensorflow_docs.api_generator.generate_lib import DocGenerator [as 別名]
def main(args):
if args[1:]:
raise ValueError('Unrecognized command line args', args[1:])
for obj in suppress_docs_for:
doc_controls.do_not_generate_docs(obj)
doc_generator = generate_lib.DocGenerator(
root_title='TensorFlow Hub',
py_modules=[('hub', hub)],
base_dir=os.path.dirname(hub.__file__),
code_url_prefix=FLAGS.code_url_prefix,
search_hints=FLAGS.search_hints,
site_path=FLAGS.site_path,
private_map={},
callbacks=[
# This filters out objects not defined in the current module or its
# sub-modules.
public_api.local_definitions_filter
])
doc_generator.build(output_dir=FLAGS.output_dir)
示例8: main
# 需要導入模塊: from tensorflow_docs.api_generator import generate_lib [as 別名]
# 或者: from tensorflow_docs.api_generator.generate_lib import DocGenerator [as 別名]
def main(unused_argv):
doc_generator = generate_lib.DocGenerator(
root_title="TensorFlow Model Optimization",
py_modules=[("tfmot", tfmot)],
base_dir=os.path.dirname(tfmot.__file__),
code_url_prefix=FLAGS.code_url_prefix,
search_hints=FLAGS.search_hints,
site_path=FLAGS.site_path,
# TODO(tfmot): remove this once the next release after 0.3.0 happens.
# This is needed in the interim because the API docs reflect
# the latest release and the current release still wildcard imports
# all of the classes below.
private_map={
"tfmot.sparsity.keras": [
# List of internal classes which get exposed when imported.
"InputLayer",
"custom_object_scope",
"pruning_sched",
"pruning_wrapper",
"absolute_import",
"division",
"print_function",
"compat"
]
},
)
doc_generator.build(output_dir=FLAGS.output_dir)
示例9: main
# 需要導入模塊: from tensorflow_docs.api_generator import generate_lib [as 別名]
# 或者: from tensorflow_docs.api_generator.generate_lib import DocGenerator [as 別名]
def main(args):
if args[1:]:
raise ValueError("Unrecognized Command line args", args[1:])
for obj in supress_docs_for:
doc_controls.do_not_generate_docs(obj)
for name, value in inspect.getmembers(tfdv):
if inspect.ismodule(value):
doc_controls.do_not_generate_docs(value)
for name, value in inspect.getmembers(beam.PTransform):
# This ensures that the methods of PTransform are not documented in any
# derived classes.
if name == "__init__":
continue
try:
doc_controls.do_not_doc_inheritable(value)
except (TypeError, AttributeError):
pass
doc_generator = generate_lib.DocGenerator(
root_title="TensorFlow Data Validation",
py_modules=[("tfdv", tfdv)],
code_url_prefix=FLAGS.code_url_prefix,
search_hints=FLAGS.search_hints,
site_path=FLAGS.site_path,
# Use private_map to exclude doc locations by name if excluding by object
# is insufficient.
private_map={},
# local_definitions_filter ensures that shared modules are only
# documented in the location that defines them, instead of every location
# that imports them.
callbacks=[public_api.local_definitions_filter, _filter_class_attributes])
return doc_generator.build(output_dir=FLAGS.output_dir)
示例10: main
# 需要導入模塊: from tensorflow_docs.api_generator import generate_lib [as 別名]
# 或者: from tensorflow_docs.api_generator.generate_lib import DocGenerator [as 別名]
def main(_):
doc_generator = generate_lib.DocGenerator(
root_title="Tensorflow Graphics",
py_modules=[("tfg", tfg)],
base_dir=os.path.dirname(tfg.__file__),
search_hints=FLAGS.search_hints,
code_url_prefix=FLAGS.code_url_prefix,
site_path=FLAGS.site_path)
doc_generator.build(output_dir=FLAGS.output_dir)
示例11: execute
# 需要導入模塊: from tensorflow_docs.api_generator import generate_lib [as 別名]
# 或者: from tensorflow_docs.api_generator.generate_lib import DocGenerator [as 別名]
def execute(output_dir, code_url_prefix, search_hints, site_path):
"""Builds API docs for tensorflow_datasets."""
# Internally, tfds.testing defaults to None. Fill it in here so that we get
# documentation.
tfds.testing = testing
doc_generator = generate_lib.DocGenerator(
root_title="TensorFlow Datasets",
py_modules=[("tfds", tfds)],
base_dir=os.path.dirname(tfds.__file__),
search_hints=search_hints,
code_url_prefix=code_url_prefix,
site_path=site_path)
doc_generator.build(output_dir)
new_redirects = []
for before, after in MOVES:
old_path = os.path.join(output_dir, before)
new_path = os.path.join(output_dir, after)
os.rename(old_path, new_path)
new_redirects.append({
"from":
os.path.join("/datasets/api_docs/python/",
os.path.splitext(before)[0]),
"to":
os.path.join("/datasets/api_docs/python/",
os.path.splitext(after)[0])
})
redirect_path = os.path.join(output_dir, "_redirects.yaml")
with open(redirect_path) as f:
redirect_content = yaml.load(f)
redirect_content["redirects"].extend(new_redirects)
with open(redirect_path, "w") as f:
yaml.dump(redirect_content, f, default_flow_style=False)
示例12: main
# 需要導入模塊: from tensorflow_docs.api_generator import generate_lib [as 別名]
# 或者: from tensorflow_docs.api_generator.generate_lib import DocGenerator [as 別名]
def main(_):
# These make up for the empty __init__.py files.
api_generator.utils.recursive_import(tfx.orchestration)
api_generator.utils.recursive_import(tfx.components)
do_not_generate_docs_for = []
for name in ["utils", "proto", "dependencies", "version"]:
submodule = getattr(tfx, name, None)
if submodule is not None:
do_not_generate_docs_for.append(submodule)
for obj in do_not_generate_docs_for:
doc_controls.do_not_generate_docs(obj)
doc_generator = generate_lib.DocGenerator(
root_title="TFX",
py_modules=[("tfx", tfx)],
code_url_prefix=FLAGS.code_url_prefix,
search_hints=FLAGS.search_hints,
site_path=FLAGS.site_path,
private_map={},
# local_definitions_filter ensures that shared modules are only
# documented in the location that defines them, instead of every location
# that imports them.
callbacks=[
api_generator.public_api.local_definitions_filter, ignore_test_objects
])
doc_generator.build(output_dir=FLAGS.output_dir)
示例13: main
# 需要導入模塊: from tensorflow_docs.api_generator import generate_lib [as 別名]
# 或者: from tensorflow_docs.api_generator.generate_lib import DocGenerator [as 別名]
def main(_):
doc_generator = generate_lib.DocGenerator(
root_title='TF-Agents',
py_modules=[('tf_agents', tf_agents)],
base_dir=os.path.dirname(tf_agents.__file__),
code_url_prefix=FLAGS.code_url_prefix,
search_hints=FLAGS.search_hints,
site_path=FLAGS.site_path,
private_map={},
callbacks=[public_api.local_definitions_filter])
sys.exit(doc_generator.build(output_dir=FLAGS.output_dir))
示例14: main
# 需要導入模塊: from tensorflow_docs.api_generator import generate_lib [as 別名]
# 或者: from tensorflow_docs.api_generator.generate_lib import DocGenerator [as 別名]
def main(_):
doc_generator = generate_lib.DocGenerator(
root_title="TensorFlow/compression",
py_modules=[("tfc", tfc)],
base_dir=os.path.dirname(tfc.__file__),
private_map={
"tfc.python.ops": ["gen_range_coding_ops", "namespace_helper"],
},
code_url_prefix="https://github.com/tensorflow/compression/tree/master/"
"tensorflow_compression",
api_cache=False,
)
sys.exit(doc_generator.build(FLAGS.output_dir))
示例15: main
# 需要導入模塊: from tensorflow_docs.api_generator import generate_lib [as 別名]
# 或者: from tensorflow_docs.api_generator.generate_lib import DocGenerator [as 別名]
def main(args):
if args[1:]:
raise ValueError('Unrecognized Command line args', args[1:])
tft_out = pathlib.Path(tempfile.mkdtemp())
doc_generator = generate_lib.DocGenerator(
root_title='TF-Transform',
py_modules=[('tft', transform)],
code_url_prefix=FLAGS.code_url_prefix,
search_hints=FLAGS.search_hints,
site_path=FLAGS.site_path,
callbacks=[public_api.explicit_package_contents_filter])
doc_generator.build(tft_out)
doc_controls.do_not_generate_docs(tft_beam.analyzer_impls)
tft_beam_out = pathlib.Path(tempfile.mkdtemp())
doc_generator = generate_lib.DocGenerator(
root_title='TFT-Beam',
py_modules=[('tft_beam', tft_beam)],
code_url_prefix=FLAGS.code_url_prefix + '/beam',
search_hints=FLAGS.search_hints,
site_path=FLAGS.site_path,
callbacks=[
public_api.explicit_package_contents_filter,
public_api.local_definitions_filter
])
doc_generator.build(tft_beam_out)
output_dir = pathlib.Path(FLAGS.output_dir)
def splice(name, tmp_dir):
shutil.rmtree(output_dir / name, ignore_errors=True)
shutil.copytree(tmp_dir / name, output_dir / name)
shutil.copy(tmp_dir / f'{name}.md', output_dir / f'{name}.md')
try:
shutil.copy(tmp_dir / '_redirects.yaml',
output_dir / name / '_redirects.yaml')
except FileNotFoundError:
pass
shutil.copy(tmp_dir / '_toc.yaml', output_dir / name / '_toc.yaml')
splice('tft', tft_out)
splice('tft_beam', tft_beam_out)
toc_path = output_dir / '_toc.yaml'
toc_text = yaml.dump(
{'toc': [
{'include': f'{FLAGS.site_path}/tft/_toc.yaml'},
{'break': True},
{'include': f'{FLAGS.site_path}/tft_beam/_toc.yaml'}]})
toc_path.write_text(toc_text)