提交 d6ca03eb 编写于 作者: D dangqingqing

Fix out of memory.

上级 aaff2ddd
......@@ -269,7 +269,7 @@ void hl_sequence2batch_copy_padding(real* batch,
int blockDimY = CUDA_BLOCK_SIZE / blockDimX;
dim3 threads(blockDimX, blockDimY);
int gridDimX = (maxSequenceLength + blockDimY - 1)/blockDimY;
int gridDimX = (maxSequenceLength + blockDimY - 1) / blockDimY;
int gridDimY = numSequences;
dim3 grid(gridDimX, gridDimY);
......
......@@ -1152,15 +1152,8 @@ void testBatch2seqPadding(int batchSize, int inputDim) {
IVectorPtr gpuSequence = IVector::create(cpuSequence->getSize(), true);
gpuSequence->copyFrom(*cpuSequence);
int newBatchSize = cpuSequence->getSize() - 1;
MatrixPtr cpuOutput = std::make_shared<CpuMatrix>(newBatchSize, inputDim);
MatrixPtr gpuOutput = std::make_shared<GpuMatrix>(newBatchSize, inputDim);
cpuOutput->zero();
gpuOutput->zero();
size_t maxSeqLen = 0;
size_t numSeq = cpuSequence->getSize() - 1;
maxSeqLen = *std::max_element(cpuSequence->getData(),
size_t maxSeqLen = *std::max_element(cpuSequence->getData(),
cpuSequence->getData() + numSeq);
MatrixPtr cBatch = std::make_shared<CpuMatrix>(numSeq * maxSeqLen, inputDim);
......@@ -1200,8 +1193,8 @@ void testBatch2seqPadding(int batchSize, int inputDim) {
}
TEST(Matrix, warpCTC) {
for (auto batchSize : {51, 1285, 3884}) {
for (auto inputDim : {32, 512, 3026}) {
for (auto batchSize : {51, 526, 2884}) {
for (auto inputDim : {32, 512, 2026}) {
VLOG(3) << " batchSize=" << batchSize << " inputDim=" << inputDim;
testBatch2seqPadding(batchSize, inputDim);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册