When using C++ API to run model, one can get output like this:
DLTensor* y;
int out_ndim = 2;
int64_t out_shape[2] = {1, 3,};
TVMArrayAlloc(out_shape, out_ndim, dtype_code, dtype_bits, dtype_lanes, device_type, device_id, &y);
// get the function from the module(run it)
tvm::runtime::PackedFunc run = mod.GetFunction("run");
// get the function from the module(get output data)
tvm::runtime::PackedFunc get_output = mod.GetFunction("get_output");
run();
get_output(0, y);
In this way, I must know the output shape first, then i can get it.
But my model is a full convolutional network, the output shape is uncertain. How can i get the output if the output shape is uncertain?
Thank you.
But i think this not very convenient.
The Python API can return the output when only passed the first param, so i think there may be a similar way in C++.