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

Class _RestoredResource

tensorflow/python/saved_model/load.py:401–434  ·  view source on GitHub ↗

Restored SavedResource.

Source from the content-addressed store, hash-verified

399
400# TODO(b/124205571,b/124092991): Solve destruction of resources.
401class _RestoredResource(tracking.TrackableResource):
402 """Restored SavedResource."""
403
404 def __init__(self, device=""):
405 super(_RestoredResource, self).__init__(device=device)
406 self._destroy_resource_fn = None
407
408 def _create_resource(self):
409 raise RuntimeError()
410
411 def _initialize(self):
412 raise RuntimeError()
413
414 @property
415 def _destroy_resource(self):
416 return self._destroy_resource_fn
417
418 @_destroy_resource.setter
419 def _destroy_resource(self, destroy_resource_fn):
420 self._resource_deleter = tracking.CapturableResourceDeleter(
421 destroy_resource_fn)
422 self._destroy_resource_fn = destroy_resource_fn
423
424 def _list_functions_for_serialization(self, unused_serialization_cache):
425 # Overwrite this method to avoid the implementation of
426 # base class to re-wrap the polymorphic functions into
427 # another layer of `tf.function`.
428 functions = {
429 "_create_resource": self._create_resource,
430 "_initialize": self._initialize,
431 }
432 if self._destroy_resource:
433 functions.update(_destroy_resource=self._destroy_resource)
434 return functions
435
436
437def _call_attribute(instance, *args, **kwargs):

Callers 1

_recreate_resourceMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected