warp-CTC安装
http://www.pianshen.com/article/862428080/
warpctc_pytorch 编译不成功的解决办法
warp-CTC是百度开源的一个可以应用在CPU和GPU上高效并行的CTC代码库,对CTC算法进行了并行处理。
warp-CTC安装:
git clone https://github.com/SeanNaren/warp-ctc.git
cd warp-ctc
mkdir build; cd build
cmake ..
make
cd ../pytorch_binding
python setup.py install
添加环境变量:
gedit ./.bashrc
export WARP_CTC_PATH=/home/xxx/warp-ctc/build
验证pytorch中warp-CTC是否可用GPU例子:
cd /home/xxx/warp-ctc/pytorch_binding/tests
python test_gpu.py
OK输出:
或:
import torch
from torch.autograd import Variable
from warpctc_pytorch import CTCLoss
ctc_loss = CTCLoss()
# expected shape of seqLength x batchSize x alphabet_size
probs = torch.FloatTensor([[[0.1, 0.6, 0.1, 0.1, 0.1], [0.1, 0.1, 0.6, 0.1, 0.1]]]).transpose(0, 1).contiguous()
labels = Variable(torch.