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

Class StackTraceMapper

tensorflow/python/autograph/impl/api.py:120–149  ·  view source on GitHub ↗

Remaps generated code to code it originated from.

Source from the content-addressed store, hash-verified

118
119
120class StackTraceMapper(tf_stack.StackTraceMapper):
121 """Remaps generated code to code it originated from."""
122
123 def __init__(self, converted_fn):
124 self._source_map = converted_fn.ag_source_map
125
126 def get_effective_source_map(self):
127 effective_source_map = self._effective_source_map
128 if effective_source_map is None:
129 if self.parent is not None:
130 parent_map = self.parent.get_effective_source_map()
131 else:
132 parent_map = {}
133
134 effective_source_map = {}
135 for loc, origin in self._source_map.items():
136 effective_source_map[(loc.filename, loc.lineno)] = (
137 origin.loc.filename, origin.loc.lineno, origin.function_name)
138
139 for key, value in parent_map.items():
140 filename, lineno, _ = value
141 value_loc = origin_info.LineLocation(filename=filename, lineno=lineno)
142 if value_loc in self._source_map:
143 origin = self._source_map[value_loc]
144 effective_source_map[key] = (
145 origin.loc.filename, origin.loc.lineno, origin.function_name)
146 else:
147 effective_source_map[key] = value
148 self._effective_source_map = effective_source_map
149 return effective_source_map
150
151
152def tf_convert(f, ctx, convert_by_default=True, user_requested=False):

Callers 1

converted_callFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected