Commit f1792ca4 by liyinqiao

Support fp16 data type for more operations and fix the minor errors. (Don't use…

Support fp16 data type for more operations and fix the minor errors.  (Don't use this! It's an incomplete version)
parent c52f9f7a
...@@ -528,7 +528,16 @@ void _SetDataRange(XTensor * tensor, DTYPE lower, DTYPE upper, DTYPE step) ...@@ -528,7 +528,16 @@ void _SetDataRange(XTensor * tensor, DTYPE lower, DTYPE upper, DTYPE step)
/* set the data from the array */ /* set the data from the array */
tensor->SetData(data, num); tensor->SetData(data, num);
delete[] data; if (tensor->dataType == X_INT) {
delete[] (int*)data;
}
else if (tensor->dataType == X_FLOAT) {
delete[] (float*)data;
}
else {
ShowNTErrors("TODO! Unsupported datatype!")
}
} }
/* /*
......
...@@ -130,16 +130,19 @@ bool CheckStackShape(const TensorList &smalls, XTensor &t, int dim) ...@@ -130,16 +130,19 @@ bool CheckStackShape(const TensorList &smalls, XTensor &t, int dim)
int order = tensor->order; int order = tensor->order;
for (int i = 0; i < tensor->order; i++) { for (int i = 0; i < tensor->order; i++) {
if (i < dim) if (i < dim) {
if (t.GetDim(i) != tensor->GetDim(i)) if (t.GetDim(i) != tensor->GetDim(i))
return false; return false;
else if (i > dim) }
else if (i > dim) {
if (t.GetDim(i) != tensor->GetDim(i-1)) if (t.GetDim(i) != tensor->GetDim(i-1))
return false; return false;
else if (i == dim) }
else if (i == dim) {
if (t.GetDim(i) != smalls.count) if (t.GetDim(i) != smalls.count)
return false; return false;
} }
}
return true; return true;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论