(c++)How to convert (tensor) type to int (type)

I use C + + to call the model of pytorch, but the model return value is tensor type, which makes me unable to do some specific operations on the return value. What should I do?

at::Tensor output = module.forward(inputs).toTensor();

@EricHuiHui
Not sure what you want to do here, can you give more information?

If you are sure your tensor will have only one item, 1 dimension 1 item. Then you can use .item(). Otherwise, you might need to use TensorIterator, or convert tensor to contiguous and get its data ptr. Please provide more info.