|
|
|
@ -158,10 +158,6 @@ public:
|
|
|
|
|
gpuSparse_->copyFrom(*cpuSparse_, stream);
|
|
|
|
|
hl_stream_synchronize(stream);
|
|
|
|
|
|
|
|
|
|
void addInputs(const SequenceArg& input) {
|
|
|
|
|
size_t batchSize = input.shape()[0];
|
|
|
|
|
size_t numSeqs = batchSize / 10 + 1;
|
|
|
|
|
|
|
|
|
|
cpuOutputs_.emplace_back(
|
|
|
|
|
std::make_shared<SparseMatrixArg>(*cpuSparse_, argType));
|
|
|
|
|
gpuOutputs_.emplace_back(
|
|
|
|
@ -301,21 +297,6 @@ protected:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void initOutputs() {
|
|
|
|
|
for (size_t i = 0; i < cpuOutputs_.size(); i++) {
|
|
|
|
|
initArg(*cpuOutputs_[i]);
|
|
|
|
|
|
|
|
|
|
// TODO: Need a BufferCopy used to copy from one BufferArg to another.
|
|
|
|
|
CpuVector cpuVector(cpuOutputs_[i]->shape().getElements(),
|
|
|
|
|
(real*)cpuOutputs_[i]->data());
|
|
|
|
|
GpuVector gpuVector(gpuOutputs_[i]->shape().getElements(),
|
|
|
|
|
(real*)gpuOutputs_[i]->data());
|
|
|
|
|
|
|
|
|
|
gpuVector.copyFrom(cpuVector);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void compareOutputs() {
|
|
|
|
|
>>>>>>> rewrite unit test using Daoyuan's new FunctionTest.
|
|
|
|
|
for (size_t i = 0; i < cpuOutputs_.size(); i++) {
|
|
|
|
|
if (cpuOutputs_[i]->isSparseArg()) {
|
|
|
|
|
continue; /// sparse matrix already init
|
|
|
|
|