Set current stream from external stream

My input image exists in a cuda stream which was created by cudaStreamCreate. Now I’m trying to set the model and other tensors to same stream in the following way,

cudaStream_t cuda_stream;
cudaStreamCreateWithPriority(&cuda_stream, cudaStreamNonBlocking, -1);

at::cuda::CUDAStream myStream = at::cuda::getStreamFromExternal(cuda_stream, 0);

This is throwing the following error

Unrecognized stream stream 3394290592 on device cuda:0 (I didn't recognize the stream type, EXT)

Is there any way to fix this?