MCPcopy Index your code
hub / github.com/pytorch/pytorch / _RegisterPythonImpl

Function _RegisterPythonImpl

caffe2/python/core.py:425–441  ·  view source on GitHub ↗
(
    f, grad_f=None, python_func_type=None, pass_workspace=False
)

Source from the content-addressed store, hash-verified

423
424
425def _RegisterPythonImpl(
426 f, grad_f=None, python_func_type=None, pass_workspace=False
427):
428 if python_func_type:
429 func = python_func_type(f)
430 f = func.forward
431 grad_f = func.backward
432 else:
433 if isinstance(f, tuple):
434 f = f[0](*f[1], **f[2])
435 if isinstance(grad_f, tuple):
436 grad_f = grad_f[0](*grad_f[1], **grad_f[2])
437
438 token = C.register_python_op(f, pass_workspace, '')
439 if grad_f:
440 C.register_python_gradient_op(token, grad_f)
441 return token
442
443
444def CreatePythonOperator(

Callers 2

CreatePythonOperatorFunction · 0.85
PythonMethod · 0.85

Calls 1

isinstanceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…