목록전체 글 (279)
ecsimsw
///"tensorflow/core/framework/op_kernel.cc" // TODO(mrry): Convert to std::make_unique when available. OpKernel::OpKernel(OpKernelConstruction* context) : OpKernel(context, std::unique_ptr(new NodeDef(context->def()))) {} OpKernel::OpKernel(OpKernelConstruction* context, std::unique_ptr node_def) : def_(std::move(node_def)), input_types_(context->input_types().begin(), context->input_types().end..
///"tensorflow/core/framework/op_kernel.h" class OpKernelConstruction { public: OpKernelConstruction(DeviceType device_type, DeviceBase* device, Allocator* allocator, const NodeDef* node_def,const OpDef* op_def, FunctionLibraryRuntime* flib, const DataTypeSlice& input_types, const MemoryTypeSlice& input_memory_types, const DataTypeSlice& output_types, const MemoryTypeSlice& output_memory_types, ..
object factory - Design pattern to instance variety type's object. - 사용 이유 자료형에 대한 정보는 있지만, C++ 에서 표현 가능한 형태가 아닌 경우 - 파일을 읽고, 객체를 생성하는 경우 - 인터넷 패킷을 받고, 객체를 생성하는 경우 객체 생성시 의무적으로 해야할 일이 있을 경우 simple example human* human_factory(char sex) { human* h = 0; switch (sex) { case 'M': h = new Man(); break; case 2: h = new Woman(); break; } return h; }
"CODE" ///"tensorflow/core/platform/file_system.h" class FileSystemRegistry { public: typedef std::function Factory; virtual ~FileSystemRegistry(); virtual Status Register(const string& scheme, Factory factory) = 0; virtual FileSystem* Lookup(const string& scheme) = 0; virtual Status GetRegisteredFileSystemSchemes( std::vector* schemes) = 0; }; /// tensorflow/core/framework/op_kernel.h namespace..
"CODE" ///op_kernel.cc :: Kernel registration struct KernelRegistration { KernelRegistration(const KernelDef& d, StringPiece c, kernel_factory::OpKernelRegistrar::Factory f) : def(d), kernel_class_name(std::string(c)), factory(f) {} const KernelDef def; const string kernel_class_name; const kernel_factory::OpKernelRegistrar::Factory factory; }; // This maps from 'op_type' + DeviceType to the set..
"CODE" ///// tensorflow/core/kernels/training_ops.cc #define REGISTER_KERNELS(T, Tindices) \ REGISTER_KERNEL_BUILDER(Name("SparseApplyProximalAdagrad") \ .Device(DEVICE_CPU) \ .TypeConstraint("T") \ .TypeConstraint("Tindices"), \ SparseApplyProximalAdagradOp); \ REGISTER_KERNEL_BUILDER(Name("ResourceSparseApplyProximalAdagrad") \ .Device(DEVICE_CPU) \ .TypeConstraint("T") \ .TypeConstraint("Tind..
std::initializer_list cppreference_ std::initializer_list Stackoverflow _The constructor initializer list and const variable initializer list className (parameter) : varName1(arg), varName2(arg) {}; - 위의 형식으로 생성자를 정의하는 것으로 생성과 동시에 멤버 변수를 초기화 하고, 이를 생성자 리스트라고 한다. #include using namespace std; class myclass { int integer; char character; public: myclass(): integer(10), character('A'){};// construc..
ctags / cscope - ctags와 cscope를 이용하여 코드를 분석하는 방법과 유용했던 팁을 정리하였다. ctags - tj 명령어 뒤에 원하는 태그 이름을 입력하는 것으로 해당 함수나 변수가 선언된 위치로 점프할 수 있다. :tj "tags" - 명령어를 이용하지 않고 원하는 함수나 변수 위에 커서를 두고 점프하고 이전으로 돌아갈 수 있다. ctrl + ] ctrl + t cscope - cs type option keyword로 실행한다. type은 add / find / help / kill / reset / show 가 있고, find(f)와 아래 옵션을 통해 키워드를 검색한다. cscope commands[f] g : find the definitions s : search this ..