x.cpu().detach().numpy() seems quite convoluted. Is that the right way to transform a tensor to a numpy array? Is there a shortform?
Currently doing this (tensor is on GPU):
    action = action.cpu().detach().numpy()
    log_prob = log_prob.cpu().detach().numpy()
    state_value = state_value.cpu().detach().numpy()

Can this maybe be written more efficiently as a with block? Can this be done in place? Is there a lot of overhead doing the above?