Registering a data packing function and return a new data type



I am trying to register an external function which pack data. I want to be able to return a handle to created data structure ( a templatized class) using ret.

.set_body([](TVMArgs args, TVMRetValue *ret) {
auto packB = new PackBMatrix<std::int8_t, std::int32_t> ( blah, blah);
*ret = *packB;

This doesn’t currently work. Any pointers on how to achieve this will be helpful


I guess one way I see in the code is to use:

Does this work with templatized classes:
eg. Will this work:

TVM_REGISTER_EXT_TYPE(PackBMatrix<std::int8_t, std::int32_t>);