How to use the Tensor with type TF_VARIANT

Hi,

When we use the C APIs to create kernels, we can create a new TF_Tensor or get from context. For the ops using generic data type such as float or int8. We can get the raw buffer pointer and do what we want.

But when we get the tensor whose type is TF_VARIANT, is there any solution that we can get the data in it and do computing ? Based on currently C APIs, we can only get some meta data of the Tensor, such as shape info, data type and so on.

Thanks

Hi @Yanzhang_Wang,

Sorry for the delayed response. The contents of TF_VARIANT tensor can’t be modified directly using current state of C API. It is better to use Tensorflow custom python wrapper to extract the contents from TF_VARIANT. Please refer to the current tensorflow documentation for latest updates.

Thank You