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

Function TFE_Py_EncodeArg

tensorflow/python/eager/pywrap_tfe_src.cc:3460–3469  ·  view source on GitHub ↗

`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

Source from the content-addressed store, hash-verified

3458//
3459// TODO(nareshmodi): Add support for sparse tensors.
3460PyObject* 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

Callers

nothing calls this directly

Calls 3

TFE_Py_EncodeArgHelperFunction · 0.85
ToPyTupleMethod · 0.80

Tested by

no test coverage detected