code
stringlengths
3
6.57k
isinstance(function.code, BuiltinCode)
mod.get('builtin_method_new')
space.is_w(w_instance, space.w_None)
space.wrap(function.name)
space.wrap(function.name)
space.is_w( self.w_class, space.w_None )
space.newtuple([new_inst, space.newtuple(tup)
StaticMethod(Wrappable)
__init__(self, w_function)
descr_staticmethod_get(self, w_obj, w_cls=None)
staticmethod(x)
__get__(obj[, type])
descr_staticmethod__new__(space, w_type, w_function)
space.wrap(StaticMethod(w_function)
ClassMethod(Wrappable)
__init__(self, w_function)
descr_classmethod_get(self, space, w_obj, w_klass=None)
space.is_w(w_klass, space.w_None)
space.type(w_obj)
space.wrap(Method(space, self.w_function, w_klass, space.w_None)
descr_classmethod__new__(space, w_type, w_function)
space.is_true(space.callable(w_function)
space.type(w_function)
getname(space, '?')
space.wrap(ClassMethod(w_function)
BuiltinFunction(Function)
__init__(self, func)
isinstance(func, Function)
descr_builtinfunction__new__(space, w_subtype, w_func)
space.interp_w(Function, w_func)
space.allocate_instance(BuiltinFunction, w_subtype)
BuiltinFunction.__init__(bltin, func)
space.wrap(bltin)
descr_function_repr(self)
self.space.wrap('<built-in function %s>' % (self.name,)
is_builtin_code(w_func)
isinstance(w_func, Method)
isinstance(w_func, Function)
w_func.getcode()
isinstance(code, BuiltinCode)
torch.cuda.is_available()
timer()
torch.cuda.synchronize()
timeit.default_timer()
Language(enum.Enum)
ValueError("C++ timing does not support globals.")
textwrap.dedent(stmt)
textwrap.dedent(setup)
timeit(self, number: int)
self._timeit_module.timeit(number)
Timer(object)
torch.nn.functional.relu(torch.add(x, 1, out=out)
ReLU(x + 1)
ReLU(x + 1)
ReLU(x + 1)
ReLU(x + 1)
ReLU(x + 1)
isinstance(stmt, str)
ValueError("Currently only a `str` stmt is supported.")
dict(globals or {})
in (Language.PYTHON, "py", "python")
self._globals.setdefault("torch", torch)
in (Language.CPP, "cpp", "c++")
ValueError(f"Invalid language `{language}`.")
IndentationError (Python)
odd (C++)
print("This is a stmt")
nprint("This is a stmt")
print("This is a stmt")
textwrap.dedent(stmt)
rstrip()
textwrap.dedent(setup)
rstrip()
valgrind_timer_interface.CopyIfCallgrind.unwrap_all(self._globals)
timeit(self, number: int = 1000000)
timeit.Timer.timeit()
statement (`stmt`)
common.set_torch_threads(self._task_spec.num_threads)
self._timer.timeit(number=max(int(number // 100)
self._timer.timeit(number=number)
repeat(self, repeat: int = -1, number: int = -1)
NotImplementedError("See `Timer.blocked_autorange.`")
autorange(self, callback: Optional[Callable[[int, float], NoReturn]] = None)
NotImplementedError("See `Timer.blocked_autorange.`")
common.set_torch_threads(self._task_spec.num_threads)
while (total_time < min_run_time)
or (not can_stop)
time_hook()
times.append(time_spent)
callback(number, time_spent)
stop_hook(times)
_estimate_block_size(self, min_run_time: float)
common.set_torch_threads(self._task_spec.num_threads)
np.median([self._timer.timeit(0)
range(5)
self._timer.timeit(number)
self._estimate_block_size(min_run_time=0.05)
time_hook()
self._timer.timeit(number)
stop_hook(times: List[float])