CppExtension¶
- paddle.utils.cpp_extension. CppExtension ( sources, *args, **kwargs ) [source]
- 
         The interface is used to config source files of customized operators and complies Op Kernel only supporting CPU device. Please use CUDAExtensionif you want to compile Op Kernel that supports both CPU and GPU devices.It further encapsulates python built-in setuptools.Extension.The arguments and usage are same as the native interface, except for no need to explicitly specifyname.A simple example: # setup.py # Compiling customized operators supporting only CPU device from paddle.utils.cpp_extension import CppExtension, setup setup( name='custom_op', ext_modules=CppExtension(sources=['relu_op.cc']) )Note It is mainly used in setupand the nama of built shared library keeps same asnameargument specified insetupinterface.- Parameters
- 
           - sources (list[str]) – Specify the C++/CUDA source files of customized operators. 
- *args (list[options], optional) – Specify other arguments same as - setuptools.Extension.
- **kwargs (dict[option], optional) – Specify other arguments same as - setuptools.Extension.
 
- Returns
- 
           An instance of setuptools.Extension
- Return type
- 
           setuptools.Extension 
 
