Would be good to add a check here that checks if it's called multiple times and/or if de_ctx if different from cuda_de_ctx, to prevent future bugs.