提交 24bdd9b8 编写于 作者: T Tao Luo 提交者: GitHub

Merge pull request #1652 from luotao1/udp

remove unnecessary UserDefinedVector
...@@ -164,15 +164,6 @@ public: ...@@ -164,15 +164,6 @@ public:
argu.value = value; argu.value = value;
data_.push_back(argu); data_.push_back(argu);
} }
/**
* @brief Append user defined data
* @param[in] ptr user defined data
*/
void appendUserDefinedPtr(UserDefinedVectorPtr ptr) {
Argument argu;
argu.udp = ptr;
data_.push_back(argu);
}
/* /*
* @brief Append argument * @brief Append argument
......
...@@ -123,46 +123,6 @@ static void resizeAndCopy(ICpuGpuVectorPtr& dest, ...@@ -123,46 +123,6 @@ static void resizeAndCopy(ICpuGpuVectorPtr& dest,
} }
} }
static void resizeAndCopy(UserDefinedVectorPtr& dest,
const UserDefinedVectorPtr& src,
bool useGpu,
hl_stream_t stream) {
if (src) {
CHECK(!useGpu) << "not implemented";
size_t height = src->size();
if (!dest) {
dest = std::make_shared<std::vector<void*>>(height);
} else {
dest->resize(height);
}
std::copy_n(src->begin(), height, dest->begin());
} else {
dest.reset();
}
}
static void resizeAndCopy(UserDefinedVectorPtr& dest,
const UserDefinedVectorPtr& src,
int32_t startPos,
int32_t copySize,
bool useGpu,
hl_stream_t stream = HPPL_STREAM_DEFAULT) {
if (src) {
CHECK(!useGpu) << "not implemented";
CHECK_LE((size_t)startPos + copySize, src->size());
size_t height = copySize;
if (!dest) {
dest = std::make_shared<std::vector<void*>>(height);
} else {
dest->resize(height);
}
std::copy_n(src->begin() + startPos, height, dest->begin());
} else {
dest.reset();
}
}
static void resizeAndCopy(SVectorPtr& dest, static void resizeAndCopy(SVectorPtr& dest,
const SVectorPtr& src, const SVectorPtr& src,
bool useGpu, bool useGpu,
...@@ -223,7 +183,6 @@ void Argument::resizeAndCopyFrom(const Argument& src, ...@@ -223,7 +183,6 @@ void Argument::resizeAndCopyFrom(const Argument& src,
false /* useGpu */, false /* useGpu */,
stream); stream);
} }
resizeAndCopy(udp, src.udp, useGpu, stream);
resizeAndCopy(strs, src.strs, useGpu, stream); resizeAndCopy(strs, src.strs, useGpu, stream);
frameWidth = src.frameWidth; frameWidth = src.frameWidth;
frameHeight = src.frameHeight; frameHeight = src.frameHeight;
...@@ -255,7 +214,6 @@ int32_t Argument::resizeAndCopyFrom(const Argument& src, ...@@ -255,7 +214,6 @@ int32_t Argument::resizeAndCopyFrom(const Argument& src,
resizeAndCopy(value, src.value, startRow, copySize, useGpu, stream); resizeAndCopy(value, src.value, startRow, copySize, useGpu, stream);
resizeAndCopy(grad, src.grad, startRow, copySize, useGpu, stream); resizeAndCopy(grad, src.grad, startRow, copySize, useGpu, stream);
resizeAndCopy(ids, src.ids, startRow, copySize, useGpu, stream); resizeAndCopy(ids, src.ids, startRow, copySize, useGpu, stream);
resizeAndCopy(udp, src.udp, startRow, copySize, useGpu, stream);
resizeAndCopy(strs, src.strs, startRow, copySize, useGpu, stream); resizeAndCopy(strs, src.strs, startRow, copySize, useGpu, stream);
return copySize; return copySize;
} else { } else {
...@@ -268,7 +226,6 @@ int32_t Argument::resizeAndCopyFrom(const Argument& src, ...@@ -268,7 +226,6 @@ int32_t Argument::resizeAndCopyFrom(const Argument& src,
resizeAndCopy(value, src.value, startRow, copyFeatureSize, useGpu, stream); resizeAndCopy(value, src.value, startRow, copyFeatureSize, useGpu, stream);
resizeAndCopy(grad, src.grad, startRow, copyFeatureSize, useGpu, stream); resizeAndCopy(grad, src.grad, startRow, copyFeatureSize, useGpu, stream);
resizeAndCopy(ids, src.ids, startRow, copyFeatureSize, useGpu, stream); resizeAndCopy(ids, src.ids, startRow, copyFeatureSize, useGpu, stream);
resizeAndCopy(udp, src.udp, startRow, copySize, useGpu, stream);
resizeAndCopy(sequenceStartPositions, resizeAndCopy(sequenceStartPositions,
src.sequenceStartPositions, src.sequenceStartPositions,
startSeq, startSeq,
......
...@@ -24,8 +24,6 @@ limitations under the License. */ ...@@ -24,8 +24,6 @@ limitations under the License. */
namespace paddle { namespace paddle {
// vector of user defined pointers
typedef std::shared_ptr<std::vector<void*>> UserDefinedVectorPtr;
typedef std::shared_ptr<std::vector<std::string>> SVectorPtr; typedef std::shared_ptr<std::vector<std::string>> SVectorPtr;
struct Argument { struct Argument {
...@@ -40,7 +38,6 @@ struct Argument { ...@@ -40,7 +38,6 @@ struct Argument {
sequenceStartPositions(nullptr), sequenceStartPositions(nullptr),
subSequenceStartPositions(nullptr), subSequenceStartPositions(nullptr),
cpuSequenceDims(nullptr), cpuSequenceDims(nullptr),
udp(nullptr),
deviceId(-1), deviceId(-1),
allCount(0), allCount(0),
valueCount(0), valueCount(0),
...@@ -63,7 +60,6 @@ struct Argument { ...@@ -63,7 +60,6 @@ struct Argument {
sequenceStartPositions = argument.sequenceStartPositions; sequenceStartPositions = argument.sequenceStartPositions;
subSequenceStartPositions = argument.subSequenceStartPositions; subSequenceStartPositions = argument.subSequenceStartPositions;
cpuSequenceDims = argument.cpuSequenceDims; cpuSequenceDims = argument.cpuSequenceDims;
udp = argument.udp;
deviceId = argument.deviceId; deviceId = argument.deviceId;
allCount = argument.allCount; allCount = argument.allCount;
frameHeight = argument.frameHeight; frameHeight = argument.frameHeight;
...@@ -96,8 +92,6 @@ struct Argument { ...@@ -96,8 +92,6 @@ struct Argument {
// dimension of sequence, stored only in CPU // dimension of sequence, stored only in CPU
IVectorPtr cpuSequenceDims; IVectorPtr cpuSequenceDims;
UserDefinedVectorPtr udp; // user defined pointer
int deviceId; // the GPU device id which the argument in int deviceId; // the GPU device id which the argument in
int allCount; // the number of output layers using this argument int allCount; // the number of output layers using this argument
mutable int valueCount; // waiting this member when layer do forward mutable int valueCount; // waiting this member when layer do forward
...@@ -137,7 +131,6 @@ struct Argument { ...@@ -137,7 +131,6 @@ struct Argument {
if (ids) return ids->getSize(); if (ids) return ids->getSize();
if (grad) return grad->getHeight(); if (grad) return grad->getHeight();
if (in) return in->getHeight(); if (in) return in->getHeight();
if (udp) return udp->size();
if (strs) return strs->size(); if (strs) return strs->size();
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册