ExternalStream
class torch.cuda.ExternalStream(stream_ptr, device=None, **kwargs)
Wrapper around an externally allocated CUDA stream.
This class is used to wrap streams allocated in other libraries in
   order to facilitate data exchange and multi-library interactions.
Note:
 This class doesn't manage the stream life-cycle, it is the user
 responsibility to keep the referenced stream alive while this
 class is being used.

Parameters:
      * stream_ptr (int) -- Integer representation of the
        cudaStream_t value. allocated externally.
  * **device** (*torch.device** or **int**, **optional*) -- the
    device where the stream was originally allocated. if device is
    specified incorrectly, subsequent launches using this stream
    may fail.

query()
  Checks if all the work submitted has been completed.

  Returns:
     A boolean indicating if all kernels in this stream are
     completed.
