parent
a3911ab540
commit
aa2aad7f09
@ -0,0 +1,41 @@
|
|||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
# Prints accumulated ONNX configuration summary
|
||||||
|
function (onnx_print_configuration_summary)
|
||||||
|
message(STATUS "")
|
||||||
|
message(STATUS "******** Summary ********")
|
||||||
|
message(STATUS " CMake version : ${CMAKE_VERSION}")
|
||||||
|
message(STATUS " CMake command : ${CMAKE_COMMAND}")
|
||||||
|
message(STATUS " System : ${CMAKE_SYSTEM_NAME}")
|
||||||
|
message(STATUS " C++ compiler : ${CMAKE_CXX_COMPILER}")
|
||||||
|
message(STATUS " C++ compiler version : ${CMAKE_CXX_COMPILER_VERSION}")
|
||||||
|
message(STATUS " CXX flags : ${CMAKE_CXX_FLAGS}")
|
||||||
|
message(STATUS " Build type : ${CMAKE_BUILD_TYPE}")
|
||||||
|
get_directory_property(tmp DIRECTORY ${PROJECT_SOURCE_DIR} COMPILE_DEFINITIONS)
|
||||||
|
message(STATUS " Compile definitions : ${tmp}")
|
||||||
|
message(STATUS " CMAKE_PREFIX_PATH : ${CMAKE_PREFIX_PATH}")
|
||||||
|
message(STATUS " CMAKE_INSTALL_PREFIX : ${CMAKE_INSTALL_PREFIX}")
|
||||||
|
message(STATUS " CMAKE_MODULE_PATH : ${CMAKE_MODULE_PATH}")
|
||||||
|
message(STATUS "")
|
||||||
|
message(STATUS " ONNX version : ${ONNX_VERSION}")
|
||||||
|
message(STATUS " ONNX NAMESPACE : ${ONNX_NAMESPACE}")
|
||||||
|
message(STATUS " ONNX_USE_LITE_PROTO : ${ONNX_USE_LITE_PROTO}")
|
||||||
|
message(STATUS " USE_PROTOBUF_SHARED_LIBS : ${ONNX_USE_PROTOBUF_SHARED_LIBS}")
|
||||||
|
message(STATUS " Protobuf_USE_STATIC_LIBS : ${Protobuf_USE_STATIC_LIBS}")
|
||||||
|
message(STATUS " ONNX_DISABLE_EXCEPTIONS : ${ONNX_DISABLE_EXCEPTIONS}")
|
||||||
|
message(STATUS " ONNX_WERROR : ${ONNX_WERROR}")
|
||||||
|
message(STATUS " ONNX_BUILD_TESTS : ${ONNX_BUILD_TESTS}")
|
||||||
|
message(STATUS " ONNX_BUILD_BENCHMARKS : ${ONNX_BUILD_BENCHMARKS}")
|
||||||
|
message(STATUS " ONNXIFI_DUMMY_BACKEND : ${ONNXIFI_DUMMY_BACKEND}")
|
||||||
|
message(STATUS " ONNXIFI_ENABLE_EXT : ${ONNXIFI_ENABLE_EXT}")
|
||||||
|
message(STATUS "")
|
||||||
|
message(STATUS " Protobuf compiler : ${PROTOBUF_PROTOC_EXECUTABLE}")
|
||||||
|
message(STATUS " Protobuf includes : ${PROTOBUF_INCLUDE_DIRS}")
|
||||||
|
message(STATUS " Protobuf libraries : ${PROTOBUF_LIBRARIES}")
|
||||||
|
message(STATUS " BUILD_ONNX_PYTHON : ${BUILD_ONNX_PYTHON}")
|
||||||
|
if (${BUILD_ONNX_PYTHON})
|
||||||
|
message(STATUS " Python version : ${PY_VERSION}")
|
||||||
|
message(STATUS " Python executable : ${PYTHON_EXECUTABLE}")
|
||||||
|
message(STATUS " Python includes : ${PYTHON_INCLUDE_DIR}")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
@ -1,50 +0,0 @@
|
|||||||
import types
|
|
||||||
|
|
||||||
|
|
||||||
class _ClassNamespace(types.ModuleType):
|
|
||||||
def __init__(self, name):
|
|
||||||
super(_ClassNamespace, self).__init__('paddlespeech.classes' + name)
|
|
||||||
self.name = name
|
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
|
||||||
proxy = None
|
|
||||||
if proxy is None:
|
|
||||||
raise RuntimeError(f'Class {self.name}.{attr} not registered!')
|
|
||||||
return proxy
|
|
||||||
|
|
||||||
|
|
||||||
class _Classes(types.ModuleType):
|
|
||||||
__file__ = '_classes.py'
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
super(_Classes, self).__init__('paddlespeech.classes')
|
|
||||||
|
|
||||||
def __getattr__(self, name):
|
|
||||||
namespace = _ClassNamespace(name)
|
|
||||||
setattr(self, name, namespace)
|
|
||||||
return namespace
|
|
||||||
|
|
||||||
@property
|
|
||||||
def loaded_libraries(self):
|
|
||||||
return paddlespeech.ops.loaded_libraries
|
|
||||||
|
|
||||||
def load_library(self, path):
|
|
||||||
"""
|
|
||||||
Loads a shared library from the given path into the current process.
|
|
||||||
The library being loaded may run global initialization code to register
|
|
||||||
custom classes with the PyTorch JIT runtime. This allows dynamically
|
|
||||||
loading custom classes. For this, you should compile your class
|
|
||||||
and the static registration code into a shared library object, and then
|
|
||||||
call ``torch.classes.load_library('path/to/libcustom.so')`` to load the
|
|
||||||
shared object.
|
|
||||||
After the library is loaded, it is added to the
|
|
||||||
``torch.classes.loaded_libraries`` attribute, a set that may be inspected
|
|
||||||
for the paths of all libraries loaded using this function.
|
|
||||||
Args:
|
|
||||||
path (str): A path to a shared library to load.
|
|
||||||
"""
|
|
||||||
paddlespeech.ops.load_library(path)
|
|
||||||
|
|
||||||
|
|
||||||
# The classes "namespace"
|
|
||||||
classes = _Classes()
|
|
Loading…
Reference in new issue