/* Generated by Cython 0.29.32 */

#ifndef __PYX_HAVE_API__dpctl__tensor___usmarray
#define __PYX_HAVE_API__dpctl__tensor___usmarray
#ifdef __MINGW64__
#define MS_WIN64
#endif
#include "Python.h"
#include "_usmarray.h"

static PyTypeObject *__pyx_ptype_5dpctl_6tensor_9_usmarray_usm_ndarray = 0;
#define PyUSMArrayType (*__pyx_ptype_5dpctl_6tensor_9_usmarray_usm_ndarray)

static char *(*__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetData)(struct PyUSMArrayObject *) = 0;
#define UsmNDArray_GetData __pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetData
static int (*__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetNDim)(struct PyUSMArrayObject *) = 0;
#define UsmNDArray_GetNDim __pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetNDim
static Py_ssize_t *(*__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetShape)(struct PyUSMArrayObject *) = 0;
#define UsmNDArray_GetShape __pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetShape
static Py_ssize_t *(*__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetStrides)(struct PyUSMArrayObject *) = 0;
#define UsmNDArray_GetStrides __pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetStrides
static int (*__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetTypenum)(struct PyUSMArrayObject *) = 0;
#define UsmNDArray_GetTypenum __pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetTypenum
static int (*__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetElementSize)(struct PyUSMArrayObject *) = 0;
#define UsmNDArray_GetElementSize __pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetElementSize
static int (*__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetFlags)(struct PyUSMArrayObject *) = 0;
#define UsmNDArray_GetFlags __pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetFlags
static DPCTLSyclQueueRef (*__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetQueueRef)(struct PyUSMArrayObject *) = 0;
#define UsmNDArray_GetQueueRef __pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetQueueRef
static Py_ssize_t (*__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetOffset)(struct PyUSMArrayObject *) = 0;
#define UsmNDArray_GetOffset __pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetOffset

static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_USM_ARRAY_C_CONTIGUOUS = 0;
#define USM_ARRAY_C_CONTIGUOUS (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_USM_ARRAY_C_CONTIGUOUS)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_USM_ARRAY_F_CONTIGUOUS = 0;
#define USM_ARRAY_F_CONTIGUOUS (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_USM_ARRAY_F_CONTIGUOUS)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_USM_ARRAY_WRITEABLE = 0;
#define USM_ARRAY_WRITEABLE (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_USM_ARRAY_WRITEABLE)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_BOOL = 0;
#define UAR_BOOL (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_BOOL)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_BYTE = 0;
#define UAR_BYTE (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_BYTE)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_UBYTE = 0;
#define UAR_UBYTE (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_UBYTE)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_SHORT = 0;
#define UAR_SHORT (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_SHORT)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_USHORT = 0;
#define UAR_USHORT (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_USHORT)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_INT = 0;
#define UAR_INT (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_INT)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_UINT = 0;
#define UAR_UINT (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_UINT)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_LONG = 0;
#define UAR_LONG (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_LONG)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_ULONG = 0;
#define UAR_ULONG (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_ULONG)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_LONGLONG = 0;
#define UAR_LONGLONG (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_LONGLONG)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_ULONGLONG = 0;
#define UAR_ULONGLONG (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_ULONGLONG)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_FLOAT = 0;
#define UAR_FLOAT (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_FLOAT)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_DOUBLE = 0;
#define UAR_DOUBLE (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_DOUBLE)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_CFLOAT = 0;
#define UAR_CFLOAT (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_CFLOAT)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_CDOUBLE = 0;
#define UAR_CDOUBLE (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_CDOUBLE)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_TYPE_SENTINEL = 0;
#define UAR_TYPE_SENTINEL (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_TYPE_SENTINEL)
static int *__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_HALF = 0;
#define UAR_HALF (*__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_HALF)
#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

#ifndef __PYX_HAVE_RT_ImportVoidPtr
#define __PYX_HAVE_RT_ImportVoidPtr
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, name);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C variable %.200s",
                PyModule_GetName(module), name);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    *p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), name, sig, desc);
        goto bad;
    }
    *p = PyCObject_AsVoidPtr(cobj);}
#endif
    if (!(*p))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

#ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C function %.200s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, desc);
        goto bad;
    }
    tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

#ifndef __PYX_HAVE_RT_ImportType_proto
#define __PYX_HAVE_RT_ImportType_proto
enum __Pyx_ImportType_CheckSize {
   __Pyx_ImportType_CheckSize_Error = 0,
   __Pyx_ImportType_CheckSize_Warn = 1,
   __Pyx_ImportType_CheckSize_Ignore = 2
};
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
#endif

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
    size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if ((size_t)basicsize < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif


static int import_dpctl__tensor___usmarray(void) {
  PyObject *module = 0;
  module = PyImport_ImportModule("dpctl.tensor._usmarray");
  if (!module) goto bad;
  if (__Pyx_ImportFunction(module, "UsmNDArray_GetData", (void (**)(void))&__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetData, "char *(struct PyUSMArrayObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "UsmNDArray_GetNDim", (void (**)(void))&__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetNDim, "int (struct PyUSMArrayObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "UsmNDArray_GetShape", (void (**)(void))&__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetShape, "Py_ssize_t *(struct PyUSMArrayObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "UsmNDArray_GetStrides", (void (**)(void))&__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetStrides, "Py_ssize_t *(struct PyUSMArrayObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "UsmNDArray_GetTypenum", (void (**)(void))&__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetTypenum, "int (struct PyUSMArrayObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "UsmNDArray_GetElementSize", (void (**)(void))&__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetElementSize, "int (struct PyUSMArrayObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "UsmNDArray_GetFlags", (void (**)(void))&__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetFlags, "int (struct PyUSMArrayObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "UsmNDArray_GetQueueRef", (void (**)(void))&__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetQueueRef, "DPCTLSyclQueueRef (struct PyUSMArrayObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "UsmNDArray_GetOffset", (void (**)(void))&__pyx_api_f_5dpctl_6tensor_9_usmarray_UsmNDArray_GetOffset, "Py_ssize_t (struct PyUSMArrayObject *)") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "USM_ARRAY_C_CONTIGUOUS", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_USM_ARRAY_C_CONTIGUOUS, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "USM_ARRAY_F_CONTIGUOUS", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_USM_ARRAY_F_CONTIGUOUS, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "USM_ARRAY_WRITEABLE", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_USM_ARRAY_WRITEABLE, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_BOOL", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_BOOL, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_BYTE", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_BYTE, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_UBYTE", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_UBYTE, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_SHORT", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_SHORT, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_USHORT", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_USHORT, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_INT", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_INT, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_UINT", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_UINT, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_LONG", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_LONG, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_ULONG", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_ULONG, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_LONGLONG", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_LONGLONG, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_ULONGLONG", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_ULONGLONG, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_FLOAT", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_FLOAT, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_DOUBLE", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_DOUBLE, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_CFLOAT", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_CFLOAT, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_CDOUBLE", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_CDOUBLE, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_TYPE_SENTINEL", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_TYPE_SENTINEL, "int") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "UAR_HALF", (void **)&__pyx_api_vp_5dpctl_6tensor_9_usmarray_UAR_HALF, "int") < 0) goto bad;
  __pyx_ptype_5dpctl_6tensor_9_usmarray_usm_ndarray = __Pyx_ImportType(module, "dpctl.tensor._usmarray", "usm_ndarray", sizeof(struct PyUSMArrayObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5dpctl_6tensor_9_usmarray_usm_ndarray) goto bad;
  Py_DECREF(module); module = 0;
  return 0;
  bad:
  Py_XDECREF(module);
  return -1;
}

#endif /* !__PYX_HAVE_API__dpctl__tensor___usmarray */
