diff --git a/paddle/gserver/layers/FactorizationMachineLayer.cpp b/paddle/gserver/layers/FactorizationMachineLayer.cpp index 8d9dcbaea7f7526dd309f284b702a26355af4a4b..e5c9d1a90d5bc6d6ee22b0f5f4fd366a38eecdc2 100644 --- a/paddle/gserver/layers/FactorizationMachineLayer.cpp +++ b/paddle/gserver/layers/FactorizationMachineLayer.cpp @@ -33,10 +33,11 @@ bool FactorizationMachineLayer::init(const LayerMap& layerMap, /* initialize the latentVectors_ */ CHECK_EQ(inputLayers_.size(), 1UL); size_t height = inputLayers_[0]->getSize(); + CHECK_EQ(parameters_[0]->getSize(), height * factorSize_); latentVectors_ = std::unique_ptr(new Weight(height, factorSize_, parameters_[0])); - v2_ = latentVectors_->getW()->clone(0, 0, useGpu_); + v2_ = Matrix::create(height, factorSize_, false, useGpu_); return true; }