Closed fiveriddle closed 2 years ago
@fiverriddle, if you would like to initialize a tensor with all elements having the same value, use the following:
float val = 1.0;
cppflow::tensor tnsr = cppflow::fill({ 1000, 5 }, val);
If you would like to initialize a tensor with various values, do the the following:
Fill a vector (1d) with the values.
Then initialize the tensor with the required shape.
std::vector<float> vals(1000*5);
cppflow::tensor tnsr = cppflow::tensor(vals, { 1000, 5 });
Closing due to inactivity.
I don't know whether I'm wrong or not, it seems that the cppflow::fill and cppflow::tensor can only support one dimension tensor in the example. If I'm wrong, could you please tell me where to or how to generate a 2d tensor like (1000,5) (row,col) and pass it into the model? Many thanks!