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

Method push_obj

tensorflow/python/framework/traceable_stack.py:92–109  ·  view source on GitHub ↗

Add object to the stack and record its filename and line information. Args: obj: An object to store on the stack. offset: Integer. If 0, the caller's stack frame is used. If 1, the caller's caller's stack frame is used. Returns: TraceableObject.SUCCESS if appr

(self, obj, offset=0)

Source from the content-addressed store, hash-verified

90 self._stack = existing_stack[:] if existing_stack else []
91
92 def push_obj(self, obj, offset=0):
93 """Add object to the stack and record its filename and line information.
94
95 Args:
96 obj: An object to store on the stack.
97 offset: Integer. If 0, the caller's stack frame is used. If 1,
98 the caller's caller's stack frame is used.
99
100 Returns:
101 TraceableObject.SUCCESS if appropriate stack information was found,
102 TraceableObject.HEURISTIC_USED if the stack was smaller than expected,
103 and TraceableObject.FAILURE if the stack was empty.
104 """
105 traceable_obj = TraceableObject(obj)
106 self._stack.append(traceable_obj)
107 # Offset is defined in "Args" as relative to the caller. We are 1 frame
108 # beyond the caller and need to compensate.
109 return traceable_obj.set_filename_and_line_from_caller(offset + 1)
110
111 def pop_obj(self):
112 """Remove last-inserted object and return it, without filename/line info."""

Callers 8

testPushPeekPopObjMethod · 0.95
testPushPeekTopObjMethod · 0.95
colocate_withMethod · 0.80
_add_device_to_stackMethod · 0.80
streamMethod · 0.80
call_push_objMethod · 0.80

Calls 3

TraceableObjectClass · 0.85
appendMethod · 0.45