#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
#ifndef THP_STREAM_INC
#define THP_STREAM_INC

#include <c10/core/Stream.h>
#include <torch/csrc/Export.h>
#include <torch/csrc/python_headers.h>

struct TORCH_PYTHON_API THPStream {
  PyObject_HEAD
  int64_t stream_id;
  int64_t device_type;
  int64_t device_index;
  // Used to switch stream context management, initialized lazily.
  PyObject* context;
  PyObject* weakreflist;
};
extern TORCH_PYTHON_API PyTypeObject* THPStreamClass;

TORCH_PYTHON_API void THPStream_init(PyObject* module);
TORCH_PYTHON_API void THPStream_dealloc_common(THPStream* self);

inline bool THPStream_Check(PyObject* obj) {
  return THPStreamClass && PyObject_IsInstance(obj, (PyObject*)THPStreamClass);
}

TORCH_PYTHON_API PyObject* THPStream_Wrap(const c10::Stream& stream);

#endif // THP_STREAM_INC

#else
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
#endif  // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
