Commit 0bdd9984 by xiaotong

Add SetDataFixedInt

parent 599ed44c
...@@ -172,6 +172,17 @@ void SetDataFixed(XTensor &tensor, DTYPE p) ...@@ -172,6 +172,17 @@ void SetDataFixed(XTensor &tensor, DTYPE p)
/* /*
generate data items with a fixed value p (in integer) generate data items with a fixed value p (in integer)
>> tensor - the tensor whose data array would be initialized >> tensor - the tensor whose data array would be initialized
>> p - an integer
*/
void SetDataFixedInt(XTensor &tensor, int p)
{
CheckNTErrors(tensor.dataType == X_INT, "An integer tensor is required!");
_SetDataFixed(&tensor, &p);
}
/*
generate data items with a fixed value p (in integer)
>> tensor - the tensor whose data array would be initialized
>> p - an int-valued number >> p - an int-valued number
*/ */
void _SetDataFixedInt(XTensor * tensor, int p) void _SetDataFixedInt(XTensor * tensor, int p)
......
...@@ -36,6 +36,9 @@ void _SetDataFixed(XTensor * tensor, void * valuePointer); ...@@ -36,6 +36,9 @@ void _SetDataFixed(XTensor * tensor, void * valuePointer);
/* generate data items with a fixed value p (in default type) */ /* generate data items with a fixed value p (in default type) */
void SetDataFixed(XTensor &tensor, DTYPE p); void SetDataFixed(XTensor &tensor, DTYPE p);
/* generate data items with a fixed value p (in integer) */
void SetDataFixedInt(XTensor &tensor, int p);
/* generate data items with a fixed value p (in int) */ /* generate data items with a fixed value p (in int) */
void _SetDataFixedInt(XTensor * tensor, int p); void _SetDataFixedInt(XTensor * tensor, int p);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论