diff --git a/third_party/tsl/tsl/profiler/lib/scoped_memory_debug_annotation.cc b/third_party/tsl/tsl/profiler/lib/scoped_memory_debug_annotation.cc index b0c94d6aae0b21..224f00e2e1fd06 100644 --- a/third_party/tsl/tsl/profiler/lib/scoped_memory_debug_annotation.cc +++ b/third_party/tsl/tsl/profiler/lib/scoped_memory_debug_annotation.cc @@ -14,9 +14,13 @@ limitations under the License. ==============================================================================*/ #include "tsl/profiler/lib/scoped_memory_debug_annotation.h" +#include + namespace tsl { namespace profiler { +std::string DefaultPendingShapeFunc() { return ""; } + /*static*/ MemoryDebugAnnotation* ScopedMemoryDebugAnnotation::ThreadMemoryDebugAnnotation() { static thread_local MemoryDebugAnnotation annotation; diff --git a/third_party/tsl/tsl/profiler/lib/scoped_memory_debug_annotation.h b/third_party/tsl/tsl/profiler/lib/scoped_memory_debug_annotation.h index 5f86bf1b2e4ddc..33de2e68f4ef88 100644 --- a/third_party/tsl/tsl/profiler/lib/scoped_memory_debug_annotation.h +++ b/third_party/tsl/tsl/profiler/lib/scoped_memory_debug_annotation.h @@ -23,6 +23,8 @@ limitations under the License. namespace tsl { namespace profiler { +std::string DefaultPendingShapeFunc(); + // Annotations for memory profiling and debugging purpose. // ScopedMemoryDebugAnnotation will cache the annotations in thread-local // memory, and some allocators will try to tag allocations with the annotations. @@ -34,7 +36,7 @@ struct MemoryDebugAnnotation { // A lambda function, when invoked, it will generate the string that describe // the shape of the pending tensor. By default, the TensorShape string is an // empty string. - std::function pending_shape_func = []() { return ""; }; + std::function pending_shape_func = DefaultPendingShapeFunc; }; // Wrapper class of MemoryDebugAnnotation for RAII.