`defun` uses dtypes and shapes instead of `Tensors` as cache keys. Dtypes are used because TensorFlow graphs are not parametric w.r.t. dtypes. Shapes are used for both performance reasons, as much TensorFlow code specializes on known shapes to produce slimmer graphs, and correctness, as some high-level APIs require shapes to be fully-known. `include_tensor_ranks_only` allows caching on arguments
| 3458 | // |
| 3459 | // TODO(nareshmodi): Add support for sparse tensors. |
| 3460 | PyObject* TFE_Py_EncodeArg(PyObject* arg, bool include_tensor_ranks_only) { |
| 3461 | EncodeResult result; |
| 3462 | const auto status = |
| 3463 | TFE_Py_EncodeArgHelper(arg, include_tensor_ranks_only, &result); |
| 3464 | if (MaybeRaiseExceptionFromStatus(status, nullptr)) { |
| 3465 | return nullptr; |
| 3466 | } |
| 3467 | |
| 3468 | return result.ToPyTuple(); |
| 3469 | } |
| 3470 | |
| 3471 | // A method prints incoming messages directly to Python's |
| 3472 | // stdout using Python's C API. This is necessary in Jupyter notebooks |
nothing calls this directly
no test coverage detected