@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.