diff options
author | 2018-05-25 13:58:51 -0700 | |
---|---|---|
committer | 2018-05-25 14:01:43 -0700 | |
commit | ea72dd6c0c8a5572d2ca34be4ca0ab43efc4570d (patch) | |
tree | 5a14a3128201bc9ee0ce2203d0191245f10b0ece /tensorflow/python/pywrap_tfe.i | |
parent | a6369634688dafa4c061f499a6adbb4e78666832 (diff) |
Add EagerTensor profiler and device shape utilities
This change includes the following steps to make
EagerTensor profiler work:
- Add a PaddedShapeFn to XlaDevice::Metadata. We need a
backend-independent way to get a fully-padded shape and
its layout on the device. This function is set during
device construction. CPU and GPU devices effectively get
an identity function since they neither change the layout
nor pad. TPU gets the appropriate function.
- Add TFE_TensorDebugInfo struct and C API methods for it.
These methods are necessary to fetch the shape and layout
from under the C API to the Python level. This can be a home
for more debug information later.
- Make EagerTensor weak referencable. This involves adding a
pointer to the list of current weak references. This addition
should have negligible overhead when profiler is not used.
The only operations on this field are setting it to null on
construction and checking if it is null on destruction.
- Adding C++ functions callable from Python to register an instance
of EagerTensorProfiler and retrieve debug information for a given
EagerTensor. These functions are used in the new "inspect" module.
- Finally, writing the actual profiler.
PiperOrigin-RevId: 198098380
Diffstat (limited to 'tensorflow/python/pywrap_tfe.i')
-rw-r--r-- | tensorflow/python/pywrap_tfe.i | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tensorflow/python/pywrap_tfe.i b/tensorflow/python/pywrap_tfe.i index 42c708b024..500dc30cc3 100644 --- a/tensorflow/python/pywrap_tfe.i +++ b/tensorflow/python/pywrap_tfe.i @@ -33,6 +33,7 @@ limitations under the License. %rename("%s") TFE_ContextAsyncClearError; %rename("%s") TFE_OpNameGetAttrType; %rename("%s") TFE_Py_InitEagerTensor; +%rename("%s") TFE_Py_SetEagerTensorProfiler; %rename("%s") TFE_Py_RegisterExceptionClass; %rename("%s") TFE_Py_RegisterGradientFunction; %rename("%s") TFE_Py_RegisterFallbackExceptionClass; @@ -60,6 +61,7 @@ limitations under the License. %rename("%s") TFE_ContextOptionsSetAsync; %rename("%s") TFE_DeleteContextOptions; %rename("%s") TFE_Py_TensorShapeSlice; +%rename("%s") TFE_Py_TensorShapeOnDevice; %{ #include "tensorflow/python/eager/pywrap_tfe.h" |