Commit 25fd50be by huchi

fixed a bug in XList

parent 913e2251
......@@ -97,8 +97,6 @@ void TensorListBase<T>::Add(T&& item)
else
newItems = (T*)mem->Alloc(mem->devID, sizeof(T) * (maxNum * 2 + 1));
memcpy(newItems, items, sizeof(T) * maxNum);
if (mem == NULL)
delete[] items;
items = newItems;
maxNum = maxNum * 2 + 1;
}
......@@ -120,8 +118,6 @@ void TensorListBase<T>::Add(const T& item)
else
newItems = (T*)mem->Alloc(mem->devID, sizeof(T) * (maxNum * 2 + 1));
memcpy(newItems, items, sizeof(T) * maxNum);
if (mem == NULL)
delete[] items;
items = newItems;
maxNum = maxNum * 2 + 1;
}
......@@ -145,8 +141,6 @@ void TensorListBase<T>::Add(T* inputItems, int inputItemCount)
else
newItems = (T*)mem->Alloc(mem->devID, sizeof(T) * newMaxNum);
memcpy(newItems, items, sizeof(T) * maxNum);
if (mem == NULL)
delete[] items;
items = newItems;
maxNum = newMaxNum;
}
......@@ -179,8 +173,6 @@ void TensorListBase<T>::Insert(int pos, const T& item)
else
newItems = (T*)mem->Alloc(mem->devID, sizeof(T) * (maxNum * 2 + 1));
memcpy(newItems, items, sizeof(T) * maxNum);
if (mem == NULL)
delete[] items;
items = newItems;
maxNum = maxNum * 2 + 1;
}
......@@ -201,8 +193,6 @@ void TensorListBase<T>::Insert(int pos, T&& item)
else
newItems = (T*)mem->Alloc(mem->devID, sizeof(T) * (maxNum * 2 + 1));
memcpy(newItems, items, sizeof(T) * maxNum);
if (mem == NULL)
delete[] items;
items = newItems;
maxNum = maxNum * 2 + 1;
}
......@@ -260,7 +250,6 @@ inline int TensorListBase<T>::FindFirst(const T& item)
template <typename T>
void TensorListBase<T>::Clear()
{
delete[] items;
count = 0;
}
......
......@@ -82,7 +82,6 @@ public:
/* maps tokens to integers */
vector<int> Token2ID(vector<string> tokens);
/* constructor */
/* load the vocabulary from a file */
explicit Vocabulary(const char* vocabPath);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论