Resolves a node id into a tensor to be captured for a function.
(self, node_id)
| 199 | concrete_function.graph.capture(bound_input) |
| 200 | |
| 201 | def _get_tensor_from_node(self, node_id): |
| 202 | """Resolves a node id into a tensor to be captured for a function.""" |
| 203 | with ops.init_scope(): |
| 204 | obj = self._nodes[node_id] |
| 205 | if ds_values.is_distributed_variable(obj): |
| 206 | return obj |
| 207 | elif resource_variable_ops.is_resource_variable(obj): |
| 208 | return obj.handle |
| 209 | elif isinstance(obj, tracking.TrackableAsset): |
| 210 | return obj.asset_path |
| 211 | elif tensor_util.is_tensor(obj): |
| 212 | return obj |
| 213 | elif isinstance(obj, tracking.CapturableResource): |
| 214 | # Note: this executes restored functions in the CapturableResource. |
| 215 | return obj.resource_handle |
| 216 | raise ValueError("Can't convert node %s to tensor" % (type(obj))) |
| 217 | |
| 218 | def _load_all(self): |
| 219 | """Load all saved objects and wire their properties.""" |
no test coverage detected