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

Function custom_getter

tensorflow/python/tpu/tpu.py:974–987  ·  view source on GitHub ↗

Variables on TPU have a few restrictions.

(getter, name, *args, **kwargs)

Source from the content-addressed store, hash-verified

972 saved_custom_getter = vscope.custom_getter
973
974 def custom_getter(getter, name, *args, **kwargs):
975 """Variables on TPU have a few restrictions."""
976 partitioner = kwargs["partitioner"]
977 if partitioner is not None:
978 kwargs["partitioner"] = None
979 logging.warning(
980 "Partitioned variables are not supported on TPU. Got "
981 "`partitioner` that is {} for variable {}. "
982 "Setting `partitioner` to `None`."
983 .format(partitioner, name))
984 if saved_custom_getter is None:
985 return getter(name, *args, **kwargs)
986 else:
987 return saved_custom_getter(getter, name, *args, **kwargs)
988
989 vscope.set_use_resource(True)
990 vscope.set_custom_getter(custom_getter)

Callers 2

get_variableMethod · 0.85
wrapped_custom_getterFunction · 0.85

Calls 2

getterFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected