From ae3ae084733b8c5db4885ac791e5f111a4477678 Mon Sep 17 00:00:00 2001 From: xutianbing Date: Wed, 8 Feb 2017 11:55:38 -0800 Subject: [PATCH] resolve merge confilicts --- paddle/function/FunctionTest.h | 19 ------------ paddle/gserver/layers/CosSimVecMatLayer.cpp | 33 --------------------- 2 files changed, 52 deletions(-) diff --git a/paddle/function/FunctionTest.h b/paddle/function/FunctionTest.h index 68587ab1a..0cfafdb27 100644 --- a/paddle/function/FunctionTest.h +++ b/paddle/function/FunctionTest.h @@ -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(*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 diff --git a/paddle/gserver/layers/CosSimVecMatLayer.cpp b/paddle/gserver/layers/CosSimVecMatLayer.cpp index 29ebe1ca9..aabafd473 100644 --- a/paddle/gserver/layers/CosSimVecMatLayer.cpp +++ b/paddle/gserver/layers/CosSimVecMatLayer.cpp @@ -18,39 +18,6 @@ limitations under the License. */ #include "paddle/utils/Stat.h" namespace paddle { -/** - * @brief A layer for computing cosine similarity between a vector - * and each row of a matrix - * out[i] = cos_scale * cos(in1, in2(i,:)); - * @note used in NEURAL TURING MACHINE - * - * Input1: a vector (batchSize * dataDim) - * - * Input2: a matrix in vector form (batchSize * (weightDim*dataDim)) - * - * Output: a vector (batchSize * weightDim) - */ - -class CosSimVecMatLayer : public Layer { -public: - explicit CosSimVecMatLayer(const LayerConfig& config) : Layer(config) {} - - ~CosSimVecMatLayer() {} - - bool init(const LayerMap& layerMap, const ParameterMap& parameterMap); - - void forward(PassType passType); - void backward(const UpdateCallback& callback = nullptr); - -protected: - MatrixPtr tmpMtx0; - MatrixPtr tmpMtx1; - MatrixPtr tmpRow0; - MatrixPtr tmpRow1; - MatrixPtr tmpRow2; - MatrixPtr tmpRow3; -}; - /** * @brief A layer for computing cosine similarity between a vector * and each row of a matrix -- GitLab