【Add new target 】How get the shape of the NDArray in runtime?

Now, I’d like to add a new target, like CPU/GPU for TVM and I work on implementing a ModuleNode for this new target. As now we have implemented our xxxDeviceAPI which inherit DeviceAPI that is responsible for allocating memory on our new device. As we know, tvm will create NDArray for input, weight and output. but we just can get the DLTensor’s data for the NDArray in ModuleNode. So how can I get the whole DLTensor or the whole NDArray, because I want get the shape of the NDArray.

@tqchen @thierry @zhiics @comaniac @manupa-arm

Thank you very much :grinning:

The container of NDArray is the DLTensor, you can just use nd_array->data to get the DLTensor or nd_array.Shape() to get the shape.

I know what you say. but Pass to ModuleNode only the DLTensor’s data, not a whole DLTensor or NDArray, so we can’t get shape.So how to pass a whole DLTensor or NDArray to the ModuleNode(runtime).

I meant use nd_array.operator->() to get the DLTensor. Now it seems I don’t really quite understand you question.