MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _add_self_references

Function _add_self_references

tensorflow/python/autograph/impl/conversion.py:605–625  ·  view source on GitHub ↗

Adds namespace references to the module that exposes the api itself.

(namespace, autograph_module)

Source from the content-addressed store, hash-verified

603
604# TODO(mdan): Move into core or replace with an actual importable module.
605def _add_self_references(namespace, autograph_module):
606 """Adds namespace references to the module that exposes the api itself."""
607 global ag_internal
608 if ag_internal is None:
609 # Craft a module that exposes parts of the external API as well as certain
610 # internal modules.
611 ag_internal = imp.new_module('autograph')
612 ag_internal.__dict__.update(autograph_module.__dict__)
613 ag_internal.ConversionOptions = converter.ConversionOptions
614 ag_internal.STD = converter.STANDARD_OPTIONS
615 ag_internal.Feature = converter.Feature
616 ag_internal.utils = utils
617 ag_internal.FunctionScope = function_wrappers.FunctionScope
618 ag_internal.with_function_scope = function_wrappers.with_function_scope
619 # TODO(mdan): Add safeguards against name clashes.
620 # We don't want to create a submodule because we want the operators to be
621 # accessible as ag__.<operator>
622 ag_internal.__dict__.update(special_functions.__dict__)
623 ag_internal.__dict__.update(operators.__dict__)
624
625 _add_reserved_symbol(namespace, 'ag__', ag_internal)
626
627
628def convert_func_to_ast(f, program_ctx, do_rename=True):

Callers 1

convert_func_to_astFunction · 0.85

Calls 2

_add_reserved_symbolFunction · 0.85
updateMethod · 0.45

Tested by

no test coverage detected