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

Method _get_name

tensorflow/python/platform/benchmark.py:161–183  ·  view source on GitHub ↗

Returns full name of class and method calling report_benchmark.

(self, overwrite_name=None)

Source from the content-addressed store, hash-verified

159 return len(cls.mro()) <= 2
160
161 def _get_name(self, overwrite_name=None):
162 """Returns full name of class and method calling report_benchmark."""
163
164 # Find the caller method (outermost Benchmark class)
165 stack = tf_inspect.stack()
166 calling_class = None
167 name = None
168 for frame in stack[::-1]:
169 f_locals = frame[0].f_locals
170 f_self = f_locals.get("self", None)
171 if isinstance(f_self, Benchmark):
172 calling_class = f_self # Get the outermost stack Benchmark call
173 name = frame[3] # Get the method name
174 break
175 if calling_class is None:
176 raise ValueError("Unable to determine calling Benchmark class.")
177
178 # Use the method name, or overwrite_name is provided.
179 name = overwrite_name or name
180 # Prefix the name with the class name.
181 class_name = type(calling_class).__name__
182 name = "%s.%s" % (class_name, name)
183 return name
184
185 def report_benchmark(
186 self,

Callers 1

report_benchmarkMethod · 0.95

Calls 3

typeFunction · 0.85
stackMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected