Commit 898ee241 by xiaotong

add NewTensor() to generate an empty XTensor

parent 04412ff1
...@@ -2065,6 +2065,13 @@ void InitTensor(XTensor * tensor, const XTensor * reference) ...@@ -2065,6 +2065,13 @@ void InitTensor(XTensor * tensor, const XTensor * reference)
reference->devID, reference->mem); reference->devID, reference->mem);
} }
/* generate a XTensor with no initialization */
XTensor * NewTensor()
{
XTensor * tensor = new XTensor();
return tensor;
}
/* /*
generate a XTensor generate a XTensor
>> myOrder - order of the tensor >> myOrder - order of the tensor
......
...@@ -439,6 +439,9 @@ void InitTensor5D(XTensor * tensor, const int d0, const int d1, const int d2, co ...@@ -439,6 +439,9 @@ void InitTensor5D(XTensor * tensor, const int d0, const int d1, const int d2, co
/* initialize a tensor with a reference tensor */ /* initialize a tensor with a reference tensor */
void InitTensor(XTensor * tensor, const XTensor * reference); void InitTensor(XTensor * tensor, const XTensor * reference);
/* generate a XTensor with no initialization */
XTensor * NewTensor();
/* generate a XTensor */ /* generate a XTensor */
XTensor * NewTensor(const int myOrder, const int * myDimSize, const TENSOR_DATA_TYPE myDataType = X_FLOAT, XTensor * NewTensor(const int myOrder, const int * myDimSize, const TENSOR_DATA_TYPE myDataType = X_FLOAT,
const float myDenseRatio = 1.0F, const int myDevID = -1, XMem * myMem = NULL); const float myDenseRatio = 1.0F, const int myDevID = -1, XMem * myMem = NULL);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论