Commit ac620226 by xiaotong

remove some code

parent 80ab70a2
...@@ -372,7 +372,7 @@ dE/da = merge(dE/c_1, ...) ...@@ -372,7 +372,7 @@ dE/da = merge(dE/c_1, ...)
void XShapeGrad::GradSplitList(XTensor * node, bool isEfficient) void XShapeGrad::GradSplitList(XTensor * node, bool isEfficient)
{ {
XLink &income = node->income; XLink &income = node->income;
XTensor * input = income.tails[0]; //XTensor * input = income.tails[0];
CheckNTErrors(income.tailNum == 1, "Wrong input tensor number for SPLIT!"); CheckNTErrors(income.tailNum == 1, "Wrong input tensor number for SPLIT!");
//CheckNTErrors(node->order == input->order + 1, "Wrong tensor orders!"); //CheckNTErrors(node->order == input->order + 1, "Wrong tensor orders!");
......
...@@ -691,65 +691,6 @@ void * XMem::AllocStandard(int myDevID, MTYPE mySize, bool myIsRebuiltIndex) ...@@ -691,65 +691,6 @@ void * XMem::AllocStandard(int myDevID, MTYPE mySize, bool myIsRebuiltIndex)
} }
/* if there is still no available memory piece, we have to obtain a new block of memory. */ /* if there is still no available memory piece, we have to obtain a new block of memory. */
else{ else{
/*MTYPE used = 0;
MTYPE total = 0;
MTYPE free = 0;
for(int i = 0; i < blockNum; i++){
if(blocks[i].mem != NULL){
used += blocks[i].used;
total += blocks[i].size;
}
}
MPieceNode * bufNodes = new MPieceNode[MILLION];
int bufNodeCount = 0;
for(int i = 0; i <= indexEntryNum; i++){
entry = memIndex + i;
node = entry->next;
while(node != NULL){
bufNodes[bufNodeCount++] = *node;
if(node->size == 0){
MPieceNode * next = node->next;
node = next;
}
else{
if(node->head.state == 1 && node->size >= mySize){
fprintf(stderr, "hit!!!!!!!!!!!\n");
}
//fprintf(stderr, "%d %lld %lld %lld\n", node->head.blockID, free, node->size, mySize);
free += node->size;
node = node->next;
}
}
}
MTYPE headSize = 0;
MTYPE headSizeUsed = 0;
for(int i = 0, j = 0; i < blockNum; i++){
XMemBlock * block = blocks + i;
if(block->mem != NULL){
MHeader * head = block->head;
while(head != NULL){
if(head->state == 1){
headSize += head->size;
//fprintf(stderr, "%d head %lld\n", j++, head->size);
}
else{
headSizeUsed += head->size;
}
head = head->next;
}
}
}
delete[] bufNodes;
fprintf(stderr, "%lld %lld\n", headSize, headSizeUsed);
fprintf(stderr, "mem: %lld %lld %lld %lld\n", used, total, free, mySize);*/
int bi; int bi;
for(bi = 0; bi < blockNum; bi++){ for(bi = 0; bi < blockNum; bi++){
XMemBlock * block = blocks + bi; XMemBlock * block = blocks + bi;
......
...@@ -1115,9 +1115,6 @@ set the value of a cell in a 3d tensor in default type ...@@ -1115,9 +1115,6 @@ set the value of a cell in a 3d tensor in default type
*/ */
bool XTensor::Set3D(DTYPE value, int d0, int d1, int d2) bool XTensor::Set3D(DTYPE value, int d0, int d1, int d2)
{ {
if (!(d2 >= 0 && d2 < dimSize[2])) {
int nnn = 0;
}
CheckNTErrors(order == 3, "Cannot get a 2d cell for a tensor whose order is not 2!"); CheckNTErrors(order == 3, "Cannot get a 2d cell for a tensor whose order is not 2!");
CheckNTErrors(d0 >= 0 && d0 < dimSize[0], "dimension 0 is out of range!"); CheckNTErrors(d0 >= 0 && d0 < dimSize[0], "dimension 0 is out of range!");
CheckNTErrors(d1 >= 0 && d1 < dimSize[1], "dimension 1 is out of range!"); CheckNTErrors(d1 >= 0 && d1 < dimSize[1], "dimension 1 is out of range!");
......
...@@ -469,7 +469,6 @@ void _CrossEntropyBackward(XTensor * dedy, const XTensor * output, ...@@ -469,7 +469,6 @@ void _CrossEntropyBackward(XTensor * dedy, const XTensor * output,
int order = output->order; int order = output->order;
int n = leadingDim < 0 ? output->order - 1 : leadingDim; int n = leadingDim < 0 ? output->order - 1 : leadingDim;
int leadingDimSize = output->GetDim(n); int leadingDimSize = output->GetDim(n);
int unitSize = dedy->unitSize;
CheckNTErrors(n >= 0 && n < output->order, CheckNTErrors(n >= 0 && n < output->order,
"Wrong leading dimension!"); "Wrong leading dimension!");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论