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

Function _maybe_wrap_custom_getter

tensorflow/python/ops/variable_scope.py:2700–2716  ·  view source on GitHub ↗

Wrap a call to a custom_getter to use the old_getter internally.

(custom_getter, old_getter)

Source from the content-addressed store, hash-verified

2698
2699
2700def _maybe_wrap_custom_getter(custom_getter, old_getter):
2701 """Wrap a call to a custom_getter to use the old_getter internally."""
2702 if old_getter is None:
2703 return custom_getter
2704
2705 # The new custom_getter should call the old one
2706 def wrapped_custom_getter(getter, *args, **kwargs):
2707 # Call:
2708 # custom_getter(
2709 # lambda: old_getter(true_getter, ...), *args, **kwargs)
2710 # which means custom_getter will call old_getter, which
2711 # will call the true_getter, perform any intermediate
2712 # processing, and return the results to the current
2713 # getter, which will also perform additional processing.
2714 return custom_getter(functools.partial(old_getter, getter), *args, **kwargs)
2715
2716 return wrapped_custom_getter
2717
2718
2719def _get_unique_variable_scope(prefix):

Callers 2

__init__Method · 0.85
__enter__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected