Fix out of memory.

cblas_new
dangqingqing 8 years ago
parent aaff2ddd84
commit d6ca03eb21

@ -1152,15 +1152,8 @@ void testBatch2seqPadding(int batchSize, int inputDim) {
IVectorPtr gpuSequence = IVector::create(cpuSequence->getSize(), true); IVectorPtr gpuSequence = IVector::create(cpuSequence->getSize(), true);
gpuSequence->copyFrom(*cpuSequence); 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; size_t numSeq = cpuSequence->getSize() - 1;
maxSeqLen = *std::max_element(cpuSequence->getData(), size_t maxSeqLen = *std::max_element(cpuSequence->getData(),
cpuSequence->getData() + numSeq); cpuSequence->getData() + numSeq);
MatrixPtr cBatch = std::make_shared<CpuMatrix>(numSeq * maxSeqLen, inputDim); MatrixPtr cBatch = std::make_shared<CpuMatrix>(numSeq * maxSeqLen, inputDim);
@ -1200,8 +1193,8 @@ void testBatch2seqPadding(int batchSize, int inputDim) {
} }
TEST(Matrix, warpCTC) { TEST(Matrix, warpCTC) {
for (auto batchSize : {51, 1285, 3884}) { for (auto batchSize : {51, 526, 2884}) {
for (auto inputDim : {32, 512, 3026}) { for (auto inputDim : {32, 512, 2026}) {
VLOG(3) << " batchSize=" << batchSize << " inputDim=" << inputDim; VLOG(3) << " batchSize=" << batchSize << " inputDim=" << inputDim;
testBatch2seqPadding(batchSize, inputDim); testBatch2seqPadding(batchSize, inputDim);
} }

Loading…
Cancel
Save