I'm working on deploy huggingface roberta model to TensorRT-LLM, which has a little tweak from Bert with the embeddings.
In RobertaEmbedding the position_ids is calculated as follows:


I need to transfer input_ids to torch.Tensor to implement this function above, can you tell me the api to achieve this or how can i write code decently to implement this function, thanks!