`f` should have a signature (inputs, outputs) If `pass_workspace` is True, the signature is changed to (inputs, outputs, workspace) where `workspace` is the workspace the op is going to run on. This is potentially dangerous (as the op can manipulate the workspace directly), use
(
f, inputs,
outputs,
grad_f=None,
pass_workspace=False,
python_func_type=None,
*args,
**kwargs
)
| 442 | |
| 443 | |
| 444 | def CreatePythonOperator( |
| 445 | f, inputs, |
| 446 | outputs, |
| 447 | grad_f=None, |
| 448 | pass_workspace=False, |
| 449 | python_func_type=None, |
| 450 | *args, |
| 451 | **kwargs |
| 452 | ): |
| 453 | """ |
| 454 | `f` should have a signature (inputs, outputs) |
| 455 | |
| 456 | If `pass_workspace` is True, the signature is changed to |
| 457 | (inputs, outputs, workspace) where `workspace` is the workspace the op |
| 458 | is going to run on. This is potentially dangerous (as the op can manipulate |
| 459 | the workspace directly), use on your own risk. |
| 460 | """ |
| 461 | kwargs["token"] = _RegisterPythonImpl( |
| 462 | f, grad_f, python_func_type, pass_workspace=pass_workspace |
| 463 | ) |
| 464 | return CreateOperator("Python", inputs, outputs, *args, **kwargs) |
| 465 | |
| 466 | |
| 467 | def GetIndexFromGradientList(g_list, name): |
searching dependent graphs…