1 /* Copyright 2016 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 #include <memory> 17 18 #include "tensorflow/core/common_runtime/debugger_state_interface.h" 19 #include "tensorflow/core/debug/debugger_state_impl.h" 20 21 namespace tensorflow { 22 namespace { 23 24 // Registers a concrete implementation of DebuggerState for use by 25 // DirectSession. 26 class DebuggerStateRegistration { 27 public: CreateDebuggerState(const DebugOptions & options)28 static std::unique_ptr<DebuggerStateInterface> CreateDebuggerState( 29 const DebugOptions& options) { 30 return std::unique_ptr<DebuggerStateInterface>(new DebuggerState(options)); 31 } 32 33 static std::unique_ptr<DebugGraphDecoratorInterface> CreateDebugGraphDecorator(const DebugOptions & options)34 CreateDebugGraphDecorator(const DebugOptions& options) { 35 return std::unique_ptr<DebugGraphDecoratorInterface>( 36 new DebugGraphDecorator(options)); 37 } 38 DebuggerStateRegistration()39 DebuggerStateRegistration() { 40 DebuggerStateRegistry::RegisterFactory(CreateDebuggerState); 41 DebugGraphDecoratorRegistry::RegisterFactory(CreateDebugGraphDecorator); 42 } 43 }; 44 45 static DebuggerStateRegistration register_debugger_state_implementation; 46 47 } // end namespace 48 } // end namespace tensorflow 49