Could you post your real use case, i.e. how the Python integer is used?
Based on your current code snippet you should be able to just use the tensor instead of converting it to an integer, but I assume it’s just an example and not your real use case.