This repository has been archived by the owner on Aug 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrap Array1<T> as torch::Tensor. (k2-fsa#173)
* Wrap Array1<T> as torch::Tensor. Fix k2host test cases. * interpret arc.weight from a float to an int. * update the comment for torch.h/torch.cu * fix linker errors for release build.
- Loading branch information
1 parent
c0be6f5
commit 3c21c9d
Showing
86 changed files
with
2,226 additions
and
1,631 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
add_subdirectory(csrc) | ||
add_subdirectory(tests) | ||
add_subdirectory(host) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
# please sort the files alphabetically | ||
pybind11_add_module(_k2 | ||
array.cc | ||
aux_labels.cc | ||
fsa.cc | ||
fsa_algo.cc | ||
fsa_equivalent.cc | ||
fsa_util.cc | ||
k2.cc | ||
properties.cc | ||
tensor.cc | ||
weights.cc | ||
# please keep the list sorted | ||
set(k2_srcs | ||
k2.cu | ||
torch.cu | ||
) | ||
|
||
target_include_directories(_k2 PRIVATE ${CMAKE_SOURCE_DIR}) | ||
if(USE_PYTORCH) | ||
add_definitions(-DTORCH_API_INCLUDE_EXTENSION_H) | ||
add_subdirectory(torch) | ||
set(k2_srcs ${k2_srcs} ${torch_srcs}) | ||
set(k2_deps | ||
${TORCH_LIBRARIES} | ||
${TORCH_DIR}/lib/libtorch_python.so | ||
) | ||
else() | ||
message(FATAL_ERROR "Please select a framework.") | ||
endif() | ||
|
||
pybind11_add_module(_k2 ${k2_srcs}) | ||
target_link_libraries(_k2 PRIVATE ${k2_deps}) | ||
target_link_libraries(_k2 PRIVATE context) | ||
target_link_libraries(_k2 PRIVATE fsa) | ||
target_include_directories(_k2 PRIVATE ${CMAKE_SOURCE_DIR}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* @brief python wrappers for k2. | ||
* | ||
* @copyright | ||
* Copyright (c) 2020 Mobvoi AI Lab, Beijing, China (authors: Fangjun Kuang) | ||
* | ||
* @copyright | ||
* See LICENSE for clarification regarding multiple authors | ||
*/ | ||
|
||
#include "k2/python/csrc/k2.h" | ||
|
||
#include "k2/python/csrc/torch.h" | ||
|
||
PYBIND11_MODULE(_k2, m) { | ||
m.doc() = "pybind11 binding of k2"; | ||
PybindTorch(m); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.