/* Generated by Cython 0.29.32 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "/home/will/PycharmProjects/Minari/venv/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h",
            "/home/will/PycharmProjects/Minari/venv/lib/python3.9/site-packages/numpy/core/include/numpy/arrayscalars.h",
            "/home/will/PycharmProjects/Minari/venv/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h",
            "/home/will/PycharmProjects/Minari/venv/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h",
            "/home/will/PycharmProjects/Minari/venv/lib/python3.9/site-packages/numpy/core/include/numpy/ufuncobject.h",
            "minari/cpp/include/minari/dataset.h"
        ],
        "extra_compile_args": [
            "-std=c++11",
            "-O3",
            "-ffast-math"
        ],
        "extra_link_args": [
            "-std=c++11"
        ],
        "include_dirs": [
            "/home/will/PycharmProjects/Minari/venv/lib/python3.9/site-packages/numpy/core/include",
            "minari/cpp/include"
        ],
        "language": "c++",
        "name": "minari.dataset",
        "sources": [
            "minari/dataset.pyx"
        ]
    },
    "module_name": "minari.dataset"
}
END: Cython Metadata */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_32"
#define CYTHON_HEX_VERSION 0x001D20F0
#define CYTHON_FUTURE_DIVISION 0
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_NOGIL 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_HEX >= 0x07030900)
  #endif
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_NOGIL 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
#elif defined(PY_NOGIL)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_NOGIL 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #ifndef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 1
  #endif
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #define CYTHON_COMPILING_IN_NOGIL 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #if PY_VERSION_HEX >= 0x030B00A4
    #undef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 0
  #elif !defined(CYTHON_FAST_THREAD_STATE)
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  #endif
  #if PY_VERSION_HEX >= 0x030B00A4
    #undef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK 0
  #elif !defined(CYTHON_USE_EXC_INFO_STACK)
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #endif
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #if PY_MAJOR_VERSION < 3
    #include "longintrepr.h"
  #endif
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef __cplusplus
  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
#endif
#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #else
    #define CYTHON_INLINE inline
  #endif
#endif
template<typename T>
void __Pyx_call_destructor(T& x) {
    x.~T();
}
template<typename T>
class __Pyx_FakeReference {
  public:
    __Pyx_FakeReference() : ptr(NULL) { }
    __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
    T *operator->() { return ptr; }
    T *operator&() { return ptr; }
    operator T&() { return *ptr; }
    template<typename U> bool operator ==(U other) { return *ptr == other; }
    template<typename U> bool operator !=(U other) { return *ptr != other; }
  private:
    T *ptr;
};

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_DefaultClassType PyType_Type
#if PY_VERSION_HEX >= 0x030B00A1
    static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f,
                                                    PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                                    PyObject *fv, PyObject *cell, PyObject* fn,
                                                    PyObject *name, int fline, PyObject *lnos) {
        PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
        PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
        const char *fn_cstr=NULL;
        const char *name_cstr=NULL;
        PyCodeObject* co=NULL;
        PyObject *type, *value, *traceback;
        PyErr_Fetch(&type, &value, &traceback);
        if (!(kwds=PyDict_New())) goto end;
        if (!(argcount=PyLong_FromLong(a))) goto end;
        if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end;
        if (!(posonlyargcount=PyLong_FromLong(0))) goto end;
        if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end;
        if (!(kwonlyargcount=PyLong_FromLong(k))) goto end;
        if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end;
        if (!(nlocals=PyLong_FromLong(l))) goto end;
        if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end;
        if (!(stacksize=PyLong_FromLong(s))) goto end;
        if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end;
        if (!(flags=PyLong_FromLong(f))) goto end;
        if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end;
        if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end;
        if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end;
        if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end;
        if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too;
        if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here
        if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too;
        Py_XDECREF((PyObject*)co);
        co = (PyCodeObject*)call_result;
        call_result = NULL;
        if (0) {
            cleanup_code_too:
            Py_XDECREF((PyObject*)co);
            co = NULL;
        }
        end:
        Py_XDECREF(kwds);
        Py_XDECREF(argcount);
        Py_XDECREF(posonlyargcount);
        Py_XDECREF(kwonlyargcount);
        Py_XDECREF(nlocals);
        Py_XDECREF(stacksize);
        Py_XDECREF(replace);
        Py_XDECREF(call_result);
        Py_XDECREF(empty);
        if (type) {
            PyErr_Restore(type, value, traceback);
        }
        return co;
    }
#else
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #if defined(PyUnicode_IS_READY)
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #else
  #define __Pyx_PyUnicode_READY(op)       (0)
  #endif
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
  #else
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  #endif
  #else
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #endif
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#ifndef PyObject_Unicode
  #define PyObject_Unicode             PyObject_Str
#endif
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsHash_t
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  #if !defined(_USE_MATH_DEFINES)
    #define _USE_MATH_DEFINES
  #endif
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#define __PYX_MARK_ERR_POS(f_index, lineno) \
    { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__minari__dataset
#define __PYX_HAVE_API__minari__dataset
/* Early includes */
#include <string.h>
#include <stdio.h>
#include "numpy/arrayobject.h"
#include "numpy/ndarrayobject.h"
#include "numpy/ndarraytypes.h"
#include "numpy/arrayscalars.h"
#include "numpy/ufuncobject.h"

    /* NumPy API declarations from "numpy/__init__.pxd" */
    
#include "ios"
#include "new"
#include "stdexcept"
#include "typeinfo"
#include <memory>
#include <vector>
#include "minari/dataset.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;

/* Header.proto */
#if !defined(CYTHON_CCOMPLEX)
  #if defined(__cplusplus)
    #define CYTHON_CCOMPLEX 1
  #elif defined(_Complex_I)
    #define CYTHON_CCOMPLEX 1
  #else
    #define CYTHON_CCOMPLEX 0
  #endif
#endif
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #include <complex>
  #else
    #include <complex.h>
  #endif
#endif
#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  #undef _Complex_I
  #define _Complex_I 1.0fj
#endif


static const char *__pyx_f[] = {
  "minari/dataset.pyx",
  "stringsource",
  "venv/lib/python3.9/site-packages/numpy/__init__.pxd",
  "venv/lib/python3.9/site-packages/Cython/Includes/cpython/type.pxd",
};
/* BufferFormatStructs.proto */
#define IS_UNSIGNED(type) (((type) -1) > 0)
struct __Pyx_StructField_;
#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
typedef struct {
  const char* name;
  struct __Pyx_StructField_* fields;
  size_t size;
  size_t arraysize[8];
  int ndim;
  char typegroup;
  char is_unsigned;
  int flags;
} __Pyx_TypeInfo;
typedef struct __Pyx_StructField_ {
  __Pyx_TypeInfo* type;
  const char* name;
  size_t offset;
} __Pyx_StructField;
typedef struct {
  __Pyx_StructField* field;
  size_t parent_offset;
} __Pyx_BufFmt_StackElem;
typedef struct {
  __Pyx_StructField root;
  __Pyx_BufFmt_StackElem* head;
  size_t fmt_offset;
  size_t new_count, enc_count;
  size_t struct_alignment;
  int is_complex;
  char enc_type;
  char new_packmode;
  char enc_packmode;
  char is_valid_array;
} __Pyx_BufFmt_Context;

/* NoFastGil.proto */
#define __Pyx_PyGILState_Ensure PyGILState_Ensure
#define __Pyx_PyGILState_Release PyGILState_Release
#define __Pyx_FastGIL_Remember()
#define __Pyx_FastGIL_Forget()
#define __Pyx_FastGilFuncInit()

/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif


/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":689
 * # in Cython to enable them only on the right systems.
 * 
 * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 */
typedef npy_int8 __pyx_t_5numpy_int8_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":690
 * 
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t
 */
typedef npy_int16 __pyx_t_5numpy_int16_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":691
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int64      int64_t
 * #ctypedef npy_int96      int96_t
 */
typedef npy_int32 __pyx_t_5numpy_int32_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":692
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_int96      int96_t
 * #ctypedef npy_int128     int128_t
 */
typedef npy_int64 __pyx_t_5numpy_int64_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":696
 * #ctypedef npy_int128     int128_t
 * 
 * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 */
typedef npy_uint8 __pyx_t_5numpy_uint8_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":697
 * 
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t
 */
typedef npy_uint16 __pyx_t_5numpy_uint16_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":698
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint64     uint64_t
 * #ctypedef npy_uint96     uint96_t
 */
typedef npy_uint32 __pyx_t_5numpy_uint32_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":699
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_uint96     uint96_t
 * #ctypedef npy_uint128    uint128_t
 */
typedef npy_uint64 __pyx_t_5numpy_uint64_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":703
 * #ctypedef npy_uint128    uint128_t
 * 
 * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float64    float64_t
 * #ctypedef npy_float80    float80_t
 */
typedef npy_float32 __pyx_t_5numpy_float32_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":704
 * 
 * ctypedef npy_float32    float32_t
 * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_float80    float80_t
 * #ctypedef npy_float128   float128_t
 */
typedef npy_float64 __pyx_t_5numpy_float64_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":713
 * # The int types are mapped a bit surprising --
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t
 */
typedef npy_long __pyx_t_5numpy_int_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":714
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   longlong_t
 * 
 */
typedef npy_longlong __pyx_t_5numpy_long_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":715
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_ulong      uint_t
 */
typedef npy_longlong __pyx_t_5numpy_longlong_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":717
 * ctypedef npy_longlong   longlong_t
 * 
 * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t
 */
typedef npy_ulong __pyx_t_5numpy_uint_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":718
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":719
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_intp       intp_t
 */
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":721
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
 */
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":722
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
 */
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":724
 * ctypedef npy_uintp      uintp_t
 * 
 * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t
 */
typedef npy_double __pyx_t_5numpy_float_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":725
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
 */
typedef npy_double __pyx_t_5numpy_double_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":726
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cfloat      cfloat_t
 */
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;

/* "minari/dataset.pyx":911
 * 
 * 
 * ctypedef np.uint8_t UINT8_t             # <<<<<<<<<<<<<<
 * ctypedef np.float32_t FLOAT_t
 * ctypedef np.int32_t INT_t
 */
typedef __pyx_t_5numpy_uint8_t __pyx_t_6minari_7dataset_UINT8_t;

/* "minari/dataset.pyx":912
 * 
 * ctypedef np.uint8_t UINT8_t
 * ctypedef np.float32_t FLOAT_t             # <<<<<<<<<<<<<<
 * ctypedef np.int32_t INT_t
 * ctypedef shared_ptr[CTransition] TransitionPtr
 */
typedef __pyx_t_5numpy_float32_t __pyx_t_6minari_7dataset_FLOAT_t;

/* "minari/dataset.pyx":913
 * ctypedef np.uint8_t UINT8_t
 * ctypedef np.float32_t FLOAT_t
 * ctypedef np.int32_t INT_t             # <<<<<<<<<<<<<<
 * ctypedef shared_ptr[CTransition] TransitionPtr
 * 
 */
typedef __pyx_t_5numpy_int32_t __pyx_t_6minari_7dataset_INT_t;
/* Declarations.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< float > __pyx_t_float_complex;
  #else
    typedef float _Complex __pyx_t_float_complex;
  #endif
#else
    typedef struct { float real, imag; } __pyx_t_float_complex;
#endif
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);

/* Declarations.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< double > __pyx_t_double_complex;
  #else
    typedef double _Complex __pyx_t_double_complex;
  #endif
#else
    typedef struct { double real, imag; } __pyx_t_double_complex;
#endif
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);


/*--- Type declarations ---*/
struct __pyx_obj_6minari_7dataset_Transition;
struct __pyx_obj_6minari_7dataset_TransitionMiniBatch;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":728
 * ctypedef npy_longdouble longdouble_t
 * 
 * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t
 */
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":729
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":730
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cdouble     complex_t
 */
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":732
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5numpy_complex_t;
struct __pyx_opt_args_6minari_7dataset__stack_frames;

/* "minari/dataset.pyx":914
 * ctypedef np.float32_t FLOAT_t
 * ctypedef np.int32_t INT_t
 * ctypedef shared_ptr[CTransition] TransitionPtr             # <<<<<<<<<<<<<<
 * 
 * 
 */
typedef std::shared_ptr<minari::CTransition>  __pyx_t_6minari_7dataset_TransitionPtr;

/* "minari/dataset.pyx":1190
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * cdef void _stack_frames(             # <<<<<<<<<<<<<<
 *     TransitionPtr transition,
 *     UINT8_t* stack,
 */
struct __pyx_opt_args_6minari_7dataset__stack_frames {
  int __pyx_n;
  bool stack_next;
};

/* "minari/dataset.pyx":917
 * 
 * 
 * cdef class Transition:             # <<<<<<<<<<<<<<
 *     """ Transition class.
 * 
 */
struct __pyx_obj_6minari_7dataset_Transition {
  PyObject_HEAD
  struct __pyx_vtabstruct_6minari_7dataset_Transition *__pyx_vtab;
  __pyx_t_6minari_7dataset_TransitionPtr _thisptr;
  bool _is_image;
  bool _is_discrete;
  PyObject *_observation;
  PyObject *_action;
  PyObject *_next_observation;
  struct __pyx_obj_6minari_7dataset_Transition *_prev_transition;
  struct __pyx_obj_6minari_7dataset_Transition *_next_transition;
};


/* "minari/dataset.pyx":1236
 * 
 * 
 * cdef class TransitionMiniBatch:             # <<<<<<<<<<<<<<
 *     """ mini-batch of Transition objects.
 * 
 */
struct __pyx_obj_6minari_7dataset_TransitionMiniBatch {
  PyObject_HEAD
  struct __pyx_vtabstruct_6minari_7dataset_TransitionMiniBatch *__pyx_vtab;
  PyObject *_transitions;
  PyArrayObject *_observations;
  PyArrayObject *_actions;
  PyArrayObject *_rewards;
  PyArrayObject *_next_observations;
  PyArrayObject *_terminations;
  PyArrayObject *_truncations;
  PyArrayObject *_n_steps;
};



/* "minari/dataset.pyx":917
 * 
 * 
 * cdef class Transition:             # <<<<<<<<<<<<<<
 *     """ Transition class.
 * 
 */

struct __pyx_vtabstruct_6minari_7dataset_Transition {
  __pyx_t_6minari_7dataset_TransitionPtr (*get_ptr)(struct __pyx_obj_6minari_7dataset_Transition *);
};
static struct __pyx_vtabstruct_6minari_7dataset_Transition *__pyx_vtabptr_6minari_7dataset_Transition;


/* "minari/dataset.pyx":1236
 * 
 * 
 * cdef class TransitionMiniBatch:             # <<<<<<<<<<<<<<
 *     """ mini-batch of Transition objects.
 * 
 */

struct __pyx_vtabstruct_6minari_7dataset_TransitionMiniBatch {
  void (*_assign_observation)(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *, int, __pyx_t_6minari_7dataset_TransitionPtr, void *, int, bool, bool);
  void (*_assign_action)(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *, int, __pyx_t_6minari_7dataset_TransitionPtr, void *, bool);
  void (*_assign_to_batch)(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *, int, __pyx_t_6minari_7dataset_TransitionPtr, void *, void *, float *, void *, float *, float *, float *, int, int, float, bool, bool);
};
static struct __pyx_vtabstruct_6minari_7dataset_TransitionMiniBatch *__pyx_vtabptr_6minari_7dataset_TransitionMiniBatch;

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* Profile.proto */
#ifndef CYTHON_PROFILE
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
  #define CYTHON_PROFILE 0
#else
  #define CYTHON_PROFILE 1
#endif
#endif
#ifndef CYTHON_TRACE_NOGIL
  #define CYTHON_TRACE_NOGIL 0
#else
  #if CYTHON_TRACE_NOGIL && !defined(CYTHON_TRACE)
    #define CYTHON_TRACE 1
  #endif
#endif
#ifndef CYTHON_TRACE
  #define CYTHON_TRACE 0
#endif
#if CYTHON_TRACE
  #undef CYTHON_PROFILE_REUSE_FRAME
#endif
#ifndef CYTHON_PROFILE_REUSE_FRAME
  #define CYTHON_PROFILE_REUSE_FRAME 0
#endif
#if CYTHON_PROFILE || CYTHON_TRACE
  #include "compile.h"
  #include "frameobject.h"
  #include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
  #if CYTHON_PROFILE_REUSE_FRAME
    #define CYTHON_FRAME_MODIFIER static
    #define CYTHON_FRAME_DEL(frame)
  #else
    #define CYTHON_FRAME_MODIFIER
    #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
  #endif
  #define __Pyx_TraceDeclarations\
      static PyCodeObject *__pyx_frame_code = NULL;\
      CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
      int __Pyx_use_tracing = 0;
  #define __Pyx_TraceFrameInit(codeobj)\
      if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj;
#if PY_VERSION_HEX >= 0x030b00a2
  #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
     (unlikely((tstate)->cframe->use_tracing) &&\
         (!(check_tracing) || !(tstate)->tracing) &&\
         (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
  #define __Pyx_EnterTracing(tstate) PyThreadState_EnterTracing(tstate)
  #define __Pyx_LeaveTracing(tstate) PyThreadState_LeaveTracing(tstate)
#elif PY_VERSION_HEX >= 0x030a00b1
  #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
     (unlikely((tstate)->cframe->use_tracing) &&\
         (!(check_tracing) || !(tstate)->tracing) &&\
         (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
  #define __Pyx_EnterTracing(tstate)\
      do { tstate->tracing++; tstate->cframe->use_tracing = 0; } while (0)
  #define __Pyx_LeaveTracing(tstate)\
      do {\
          tstate->tracing--;\
          tstate->cframe->use_tracing = ((CYTHON_TRACE && tstate->c_tracefunc != NULL)\
                                 || tstate->c_profilefunc != NULL);\
      } while (0)
#else
  #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
     (unlikely((tstate)->use_tracing) &&\
         (!(check_tracing) || !(tstate)->tracing) &&\
         (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
  #define __Pyx_EnterTracing(tstate)\
      do { tstate->tracing++; tstate->use_tracing = 0; } while (0)
  #define __Pyx_LeaveTracing(tstate)\
      do {\
          tstate->tracing--;\
          tstate->use_tracing = ((CYTHON_TRACE && tstate->c_tracefunc != NULL)\
                                         || tstate->c_profilefunc != NULL);\
      } while (0)
#endif
  #ifdef WITH_THREAD
  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
  if (nogil) {\
      if (CYTHON_TRACE_NOGIL) {\
          PyThreadState *tstate;\
          PyGILState_STATE state = PyGILState_Ensure();\
          tstate = __Pyx_PyThreadState_Current;\
          if (__Pyx_IsTracing(tstate, 1, 1)) {\
              __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
          }\
          PyGILState_Release(state);\
          if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
      }\
  } else {\
      PyThreadState* tstate = PyThreadState_GET();\
      if (__Pyx_IsTracing(tstate, 1, 1)) {\
          __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
          if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
      }\
  }
  #else
  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
  {   PyThreadState* tstate = PyThreadState_GET();\
      if (__Pyx_IsTracing(tstate, 1, 1)) {\
          __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
          if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
      }\
  }
  #endif
  #define __Pyx_TraceException()\
  if (likely(!__Pyx_use_tracing)); else {\
      PyThreadState* tstate = __Pyx_PyThreadState_Current;\
      if (__Pyx_IsTracing(tstate, 0, 1)) {\
          __Pyx_EnterTracing(tstate);\
          PyObject *exc_info = __Pyx_GetExceptionTuple(tstate);\
          if (exc_info) {\
              if (CYTHON_TRACE && tstate->c_tracefunc)\
                  tstate->c_tracefunc(\
                      tstate->c_traceobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
              tstate->c_profilefunc(\
                  tstate->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
              Py_DECREF(exc_info);\
          }\
          __Pyx_LeaveTracing(tstate);\
      }\
  }
  static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result) {
      PyObject *type, *value, *traceback;
      __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
      __Pyx_EnterTracing(tstate);
      if (CYTHON_TRACE && tstate->c_tracefunc)
          tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result);
      if (tstate->c_profilefunc)
          tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result);
      CYTHON_FRAME_DEL(frame);
      __Pyx_LeaveTracing(tstate);
      __Pyx_ErrRestoreInState(tstate, type, value, traceback);
  }
  #ifdef WITH_THREAD
  #define __Pyx_TraceReturn(result, nogil)\
  if (likely(!__Pyx_use_tracing)); else {\
      if (nogil) {\
          if (CYTHON_TRACE_NOGIL) {\
              PyThreadState *tstate;\
              PyGILState_STATE state = PyGILState_Ensure();\
              tstate = __Pyx_PyThreadState_Current;\
              if (__Pyx_IsTracing(tstate, 0, 0)) {\
                  __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
              }\
              PyGILState_Release(state);\
          }\
      } else {\
          PyThreadState* tstate = __Pyx_PyThreadState_Current;\
          if (__Pyx_IsTracing(tstate, 0, 0)) {\
              __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
          }\
      }\
  }
  #else
  #define __Pyx_TraceReturn(result, nogil)\
  if (likely(!__Pyx_use_tracing)); else {\
      PyThreadState* tstate = __Pyx_PyThreadState_Current;\
      if (__Pyx_IsTracing(tstate, 0, 0)) {\
          __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
      }\
  }
  #endif
  static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno);
  static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate, const char *funcname, const char *srcfile, int firstlineno);
#else
  #define __Pyx_TraceDeclarations
  #define __Pyx_TraceFrameInit(codeobj)
  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)   if ((1)); else goto_error;
  #define __Pyx_TraceException()
  #define __Pyx_TraceReturn(result, nogil)
#endif
#if CYTHON_TRACE
  static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame, int lineno) {
      int ret;
      PyObject *type, *value, *traceback;
      __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
      __Pyx_PyFrame_SetLineNumber(frame, lineno);
      __Pyx_EnterTracing(tstate);
      ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL);
      __Pyx_LeaveTracing(tstate);
      if (likely(!ret)) {
          __Pyx_ErrRestoreInState(tstate, type, value, traceback);
      } else {
          Py_XDECREF(type);
          Py_XDECREF(value);
          Py_XDECREF(traceback);
      }
      return ret;
  }
  #ifdef WITH_THREAD
  #define __Pyx_TraceLine(lineno, nogil, goto_error)\
  if (likely(!__Pyx_use_tracing)); else {\
      if (nogil) {\
          if (CYTHON_TRACE_NOGIL) {\
              int ret = 0;\
              PyThreadState *tstate;\
              PyGILState_STATE state = PyGILState_Ensure();\
              tstate = __Pyx_PyThreadState_Current;\
              if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
                  ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
              }\
              PyGILState_Release(state);\
              if (unlikely(ret)) goto_error;\
          }\
      } else {\
          PyThreadState* tstate = __Pyx_PyThreadState_Current;\
          if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
              int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
              if (unlikely(ret)) goto_error;\
          }\
      }\
  }
  #else
  #define __Pyx_TraceLine(lineno, nogil, goto_error)\
  if (likely(!__Pyx_use_tracing)); else {\
      PyThreadState* tstate = __Pyx_PyThreadState_Current;\
      if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
          int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
          if (unlikely(ret)) goto_error;\
      }\
  }
  #endif
#else
  #define __Pyx_TraceLine(lineno, nogil, goto_error)   if ((1)); else goto_error;
#endif

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* RaiseDoubleKeywords.proto */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywords.proto */
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
    const char* function_name);

/* PyDictVersioning.proto */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __pyx_dict_cached_value;\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
#define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
#if CYTHON_FAST_PYCALL
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
#if PY_VERSION_HEX >= 0x030b00a6
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif // CYTHON_FAST_PYCALL
#endif

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCall2Args.proto */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* SliceObject.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* IterFinish.proto */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* UnpackItemEndCheck.proto */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* PyObjectFormatSimple.proto */
#if CYTHON_COMPILING_IN_PYPY
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#elif PY_MAJOR_VERSION < 3
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\
        PyObject_Format(s, f))
#elif CYTHON_USE_TYPE_SLOTS
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_str(s) :\
        likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_str(s) :\
        PyObject_Format(s, f))
#else
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#endif

/* IncludeStringH.proto */
#include <string.h>

/* JoinPyUnicode.proto */
static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char);

/* PyObjectLookupSpecial.proto */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
    PyObject *res;
    PyTypeObject *tp = Py_TYPE(obj);
#if PY_MAJOR_VERSION < 3
    if (unlikely(PyInstance_Check(obj)))
        return __Pyx_PyObject_GetAttrStr(obj, attr_name);
#endif
    res = _PyType_Lookup(tp, attr_name);
    if (likely(res)) {
        descrgetfunc f = Py_TYPE(res)->tp_descr_get;
        if (!f) {
            Py_INCREF(res);
        } else {
            res = f(res, obj, (PyObject *)tp);
        }
    } else {
        PyErr_SetObject(PyExc_AttributeError, attr_name);
    }
    return res;
}
#else
#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
#endif

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* IsLittleEndian.proto */
static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);

/* BufferFormatCheck.proto */
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type);

/* BufferGetAndValidate.proto */
#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
    ((obj == Py_None || obj == NULL) ?\
    (__Pyx_ZeroBuffer(buf), 0) :\
    __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
static int  __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
    __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
static void __Pyx_ZeroBuffer(Py_buffer* buf);
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };

/* BufferFallbackError.proto */
static void __Pyx_RaiseBufferFallbackError(void);

/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil);

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

/* PyObject_GenericGetAttr.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
#endif

/* SetVTable.proto */
static int __Pyx_SetVtable(PyObject *dict, void *vtable);

/* PyObjectGetAttrStrNoError.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

/* TypeImport.proto */
#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

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunctionShared.proto */
#define __Pyx_CyFunction_USED 1
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    size_t defaults_size;  // used by FusedFunction for copying defaults
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

/* CythonFunction.proto */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);

/* SetNameInClass.proto */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
#elif CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
#else
#define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
#endif

/* ClassMethod.proto */
#include "descrobject.h"
static CYTHON_UNUSED PyObject* __Pyx_Method_ClassMethod(PyObject *method);

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* None.proto */
#include <new>

/* BufferStructDeclare.proto */
typedef struct {
  Py_ssize_t shape, strides, suboffsets;
} __Pyx_Buf_DimInfo;
typedef struct {
  size_t refcount;
  Py_buffer pybuffer;
} __Pyx_Buffer;
typedef struct {
  __Pyx_Buffer *rcbuffer;
  char *data;
  __Pyx_Buf_DimInfo diminfo[8];
} __Pyx_LocalBuf_ND;

#if PY_MAJOR_VERSION < 3
    static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
    static void __Pyx_ReleaseBuffer(Py_buffer *view);
#else
    #define __Pyx_GetBuffer PyObject_GetBuffer
    #define __Pyx_ReleaseBuffer PyBuffer_Release
#endif


/* GCCDiagnostics.proto */
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define __Pyx_HAS_GCC_DIAGNOSTIC
#endif

/* CppExceptionConversion.proto */
#ifndef __Pyx_CppExn2PyErr
#include <new>
#include <typeinfo>
#include <stdexcept>
#include <ios>
static void __Pyx_CppExn2PyErr() {
  try {
    if (PyErr_Occurred())
      ; // let the latest Python exn pass through and ignore the current one
    else
      throw;
  } catch (const std::bad_alloc& exn) {
    PyErr_SetString(PyExc_MemoryError, exn.what());
  } catch (const std::bad_cast& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::bad_typeid& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::domain_error& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::invalid_argument& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::ios_base::failure& exn) {
    PyErr_SetString(PyExc_IOError, exn.what());
  } catch (const std::out_of_range& exn) {
    PyErr_SetString(PyExc_IndexError, exn.what());
  } catch (const std::overflow_error& exn) {
    PyErr_SetString(PyExc_OverflowError, exn.what());
  } catch (const std::range_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::underflow_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::exception& exn) {
    PyErr_SetString(PyExc_RuntimeError, exn.what());
  }
  catch (...)
  {
    PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
  }
}
#endif

/* RealImag.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #define __Pyx_CREAL(z) ((z).real())
    #define __Pyx_CIMAG(z) ((z).imag())
  #else
    #define __Pyx_CREAL(z) (__real__(z))
    #define __Pyx_CIMAG(z) (__imag__(z))
  #endif
#else
    #define __Pyx_CREAL(z) ((z).real)
    #define __Pyx_CIMAG(z) ((z).imag)
#endif
#if defined(__cplusplus) && CYTHON_CCOMPLEX\
        && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
#else
    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq_float(a, b)   ((a)==(b))
    #define __Pyx_c_sum_float(a, b)  ((a)+(b))
    #define __Pyx_c_diff_float(a, b) ((a)-(b))
    #define __Pyx_c_prod_float(a, b) ((a)*(b))
    #define __Pyx_c_quot_float(a, b) ((a)/(b))
    #define __Pyx_c_neg_float(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
    #define __Pyx_c_conj_float(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_float(z)     (::std::abs(z))
        #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_float(z) ((z)==0)
    #define __Pyx_c_conj_float(z)    (conjf(z))
    #if 1
        #define __Pyx_c_abs_float(z)     (cabsf(z))
        #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
    #if 1
        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
    #endif
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq_double(a, b)   ((a)==(b))
    #define __Pyx_c_sum_double(a, b)  ((a)+(b))
    #define __Pyx_c_diff_double(a, b) ((a)-(b))
    #define __Pyx_c_prod_double(a, b) ((a)*(b))
    #define __Pyx_c_quot_double(a, b) ((a)/(b))
    #define __Pyx_c_neg_double(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
    #define __Pyx_c_conj_double(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_double(z)     (::std::abs(z))
        #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_double(z) ((z)==0)
    #define __Pyx_c_conj_double(z)    (conj(z))
    #if 1
        #define __Pyx_c_abs_double(z)     (cabs(z))
        #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
    #endif
#endif

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);

static __pyx_t_6minari_7dataset_TransitionPtr __pyx_f_6minari_7dataset_10Transition_get_ptr(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self); /* proto*/
static void __pyx_f_6minari_7dataset_19TransitionMiniBatch__assign_observation(CYTHON_UNUSED struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self, int __pyx_v_batch_index, __pyx_t_6minari_7dataset_TransitionPtr __pyx_v_ptr, void *__pyx_v_observations_ptr, int __pyx_v_n_frames, bool __pyx_v_is_image, bool __pyx_v_is_next); /* proto*/
static void __pyx_f_6minari_7dataset_19TransitionMiniBatch__assign_action(CYTHON_UNUSED struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self, int __pyx_v_batch_index, __pyx_t_6minari_7dataset_TransitionPtr __pyx_v_ptr, void *__pyx_v_actions_ptr, bool __pyx_v_is_discrete); /* proto*/
static void __pyx_f_6minari_7dataset_19TransitionMiniBatch__assign_to_batch(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self, int __pyx_v_batch_index, __pyx_t_6minari_7dataset_TransitionPtr __pyx_v_ptr, void *__pyx_v_observations_ptr, void *__pyx_v_actions_ptr, float *__pyx_v_rewards_ptr, void *__pyx_v_next_observations_ptr, float *__pyx_v_terminations_ptr, float *__pyx_v_truncations_ptr, float *__pyx_v_n_steps_ptr, int __pyx_v_n_frames, int __pyx_v_n_steps, float __pyx_v_gamma, bool __pyx_v_is_image, bool __pyx_v_is_discrete); /* proto*/

/* Module declarations from 'cpython.buffer' */

/* Module declarations from 'libc.string' */

/* Module declarations from 'libc.stdio' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;

/* Module declarations from 'cpython' */

/* Module declarations from 'cpython.object' */

/* Module declarations from 'cpython.ref' */

/* Module declarations from 'cpython.mem' */

/* Module declarations from 'numpy' */

/* Module declarations from 'numpy' */
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
static PyTypeObject *__pyx_ptype_5numpy_number = 0;
static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
static PyTypeObject *__pyx_ptype_5numpy_character = 0;
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;

/* Module declarations from 'libcpp' */

/* Module declarations from 'libcpp.memory' */

/* Module declarations from 'libcpp.vector' */

/* Module declarations from 'cython' */

/* Module declarations from 'minari.dataset' */
static PyTypeObject *__pyx_ptype_6minari_7dataset_Transition = 0;
static PyTypeObject *__pyx_ptype_6minari_7dataset_TransitionMiniBatch = 0;
static void __pyx_f_6minari_7dataset__stack_frames(__pyx_t_6minari_7dataset_TransitionPtr, __pyx_t_6minari_7dataset_UINT8_t *, int, struct __pyx_opt_args_6minari_7dataset__stack_frames *__pyx_optional_args); /*proto*/
static std::vector<int>  __pyx_convert_vector_from_py_int(PyObject *); /*proto*/
static PyObject *__pyx_convert_vector_to_py_int(const std::vector<int>  &); /*proto*/
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_6minari_7dataset_FLOAT_t = { "FLOAT_t", NULL, sizeof(__pyx_t_6minari_7dataset_FLOAT_t), { 0 }, 0, 'R', 0, 0 };
#define __Pyx_MODULE_NAME "minari.dataset"
extern int __pyx_module_is_main_minari__dataset;
int __pyx_module_is_main_minari__dataset = 0;

/* Implementation of 'minari.dataset' */
static PyObject *__pyx_builtin_property;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_UserWarning;
static PyObject *__pyx_builtin_zip;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_ImportError;
static const char __pyx_k_f[] = "f";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_r[] = "r";
static const char __pyx_k_w[] = "w";
static const char __pyx_k_np[] = "np";
static const char __pyx_k_os[] = "os";
static const char __pyx_k_1_0[] = "1.0";
static const char __pyx_k_LOG[] = "LOG";
static const char __pyx_k__32[] = ".";
static const char __pyx_k__35[] = "~";
static const char __pyx_k_all[] = "all";
static const char __pyx_k_cls[] = "cls";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_len[] = "__len__";
static const char __pyx_k_max[] = "max";
static const char __pyx_k_min[] = "min";
static const char __pyx_k_std[] = "std";
static const char __pyx_k_sum[] = "sum";
static const char __pyx_k_zip[] = "zip";
static const char __pyx_k_File[] = "File";
static const char __pyx_k_Path[] = "Path";
static const char __pyx_k_axis[] = "axis";
static const char __pyx_k_bins[] = "bins";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_exit[] = "__exit__";
static const char __pyx_k_h5py[] = "h5py";
static const char __pyx_k_hdf5[] = ".hdf5";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_iter[] = "__iter__";
static const char __pyx_k_join[] = "join";
static const char __pyx_k_load[] = "load";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_mean[] = "mean";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_path[] = "path";
static const char __pyx_k_rets[] = "rets";
static const char __pyx_k_save[] = "save";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_size[] = "size";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_warn[] = "warn";
static const char __pyx_k_array[] = "array";
static const char __pyx_k_dtype[] = "dtype";
static const char __pyx_k_empty[] = "empty";
static const char __pyx_k_enter[] = "__enter__";
static const char __pyx_k_flush[] = "flush";
static const char __pyx_k_fname[] = "fname";
static const char __pyx_k_freqs[] = "freqs";
static const char __pyx_k_gamma[] = "gamma";
static const char __pyx_k_hists[] = "hists";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_int32[] = "int32";
static const char __pyx_k_isnan[] = "isnan";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_shape[] = "shape";
static const char __pyx_k_stats[] = "stats";
static const char __pyx_k_uint8[] = "uint8";
static const char __pyx_k_action[] = "action";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_arange[] = "arange";
static const char __pyx_k_author[] = "author";
static const char __pyx_k_extend[] = "extend";
static const char __pyx_k_hstack[] = "hstack";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_logger[] = "logger";
static const char __pyx_k_minari[] = ".minari";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_return[] = "return";
static const char __pyx_k_reward[] = "reward";
static const char __pyx_k_vstack[] = "vstack";
static const char __pyx_k_Episode[] = "Episode";
static const char __pyx_k_actions[] = "actions";
static const char __pyx_k_asarray[] = "asarray";
static const char __pyx_k_dataset[] = "dataset";
static const char __pyx_k_environ[] = "environ";
static const char __pyx_k_episode[] = "episode";
static const char __pyx_k_float32[] = "float32";
static const char __pyx_k_getitem[] = "__getitem__";
static const char __pyx_k_message[] = "message";
static const char __pyx_k_n_steps[] = "n_steps";
static const char __pyx_k_pathlib[] = "pathlib";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_reshape[] = "reshape";
static const char __pyx_k_rewards[] = "rewards";
static const char __pyx_k_version[] = "version";
static const char __pyx_k_warning[] = "warning";
static const char __pyx_k_author_2[] = "_author";
static const char __pyx_k_datasets[] = "datasets";
static const char __pyx_k_episodes[] = "_episodes";
static const char __pyx_k_exist_ok[] = "exist_ok";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_makedirs[] = "makedirs";
static const char __pyx_k_n_frames[] = "n_frames";
static const char __pyx_k_num_data[] = "num_data";
static const char __pyx_k_property[] = "property";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_warnings[] = "warnings";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_actions_2[] = "_actions";
static const char __pyx_k_file_path[] = "file_path";
static const char __pyx_k_histogram[] = "histogram";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_rewards_2[] = "_rewards";
static const char __pyx_k_safe_size[] = "_safe_size";
static const char __pyx_k_seed_used[] = "seed_used";
static const char __pyx_k_Transition[] = "Transition";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_episodes_2[] = "episodes";
static const char __pyx_k_expanduser[] = "expanduser";
static const char __pyx_k_head_index[] = "head_index";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_transition[] = "transition";
static const char __pyx_k_truncation[] = "truncation";
static const char __pyx_k_zeros_like[] = "zeros_like";
static const char __pyx_k_ImportError[] = "ImportError";
static const char __pyx_k_UserWarning[] = "UserWarning";
static const char __pyx_k_action_size[] = "action_size";
static const char __pyx_k_clear_links[] = "clear_links";
static const char __pyx_k_int_actions[] = "int_actions";
static const char __pyx_k_logical_not[] = "logical_not";
static const char __pyx_k_observation[] = "observation";
static const char __pyx_k_seed_used_2[] = "_seed_used";
static const char __pyx_k_termination[] = "termination";
static const char __pyx_k_to_episodes[] = "_to_episodes";
static const char __pyx_k_transitions[] = "_transitions";
static const char __pyx_k_truncations[] = "truncations";
static const char __pyx_k_Episode_size[] = "Episode.size";
static const char __pyx_k_author_email[] = "author_email";
static const char __pyx_k_dataset_name[] = "dataset_name";
static const char __pyx_k_observations[] = "observations";
static const char __pyx_k_stringsource[] = "stringsource";
static const char __pyx_k_terminations[] = "terminations";
static const char __pyx_k_truncation_2[] = "_truncation";
static const char __pyx_k_Episode___len[] = "Episode.__len__";
static const char __pyx_k_MinariDataset[] = "MinariDataset";
static const char __pyx_k_compute_stats[] = "compute_stats";
static const char __pyx_k_datasets_path[] = "datasets_path";
static const char __pyx_k_float_actions[] = "float_actions";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_termination_2[] = "_termination";
static const char __pyx_k_transitions_2[] = "transitions";
static const char __pyx_k_truncations_2[] = "_truncations";
static const char __pyx_k_Episode___init[] = "Episode.__init__";
static const char __pyx_k_Episode___iter[] = "Episode.__iter__";
static const char __pyx_k_algorithm_name[] = "algorithm_name";
static const char __pyx_k_author_email_2[] = "_author_email";
static const char __pyx_k_build_episodes[] = "build_episodes";
static const char __pyx_k_code_permalink[] = "code_permalink";
static const char __pyx_k_compute_return[] = "compute_return";
static const char __pyx_k_create_dataset[] = "create_dataset";
static const char __pyx_k_dataset_name_2[] = "_dataset_name";
static const char __pyx_k_minari_dataset[] = "minari.dataset";
static const char __pyx_k_observations_2[] = "_observations";
static const char __pyx_k_terminations_2[] = "_terminations";
static const char __pyx_k_to_transitions[] = "_to_transitions";
static const char __pyx_k_Episode_actions[] = "Episode.actions";
static const char __pyx_k_Episode_rewards[] = "Episode.rewards";
static const char __pyx_k_discrete_action[] = "discrete_action";
static const char __pyx_k_episode_returns[] = "episode_returns";
static const char __pyx_k_get_action_size[] = "get_action_size";
static const char __pyx_k_next_transition[] = "next_transition";
static const char __pyx_k_prev_transition[] = "prev_transition";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_algorithm_name_2[] = "_algorithm_name";
static const char __pyx_k_code_permalink_2[] = "_code_permalink";
static const char __pyx_k_environment_name[] = "environment_name";
static const char __pyx_k_next_observation[] = "next_observation";
static const char __pyx_k_Episode___getitem[] = "Episode.__getitem__";
static const char __pyx_k_build_transitions[] = "build_transitions";
static const char __pyx_k_environment_stack[] = "environment_stack";
static const char __pyx_k_episode_terminals[] = "episode_terminals";
static const char __pyx_k_observation_shape[] = "observation_shape";
static const char __pyx_k_Episode_truncation[] = "Episode.truncation";
static const char __pyx_k_MinariDataset_load[] = "MinariDataset.load";
static const char __pyx_k_MinariDataset_save[] = "MinariDataset.save";
static const char __pyx_k_MinariDataset_size[] = "MinariDataset.size";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_environment_name_2[] = "_environment_name";
static const char __pyx_k_is_action_discrete[] = "is_action_discrete";
static const char __pyx_k_minari_dataset_pyx[] = "minari/dataset.pyx";
static const char __pyx_k_Action_size_must_be[] = "Action size must be ";
static const char __pyx_k_Episode_termination[] = "Episode.termination";
static const char __pyx_k_Episode_transitions[] = "Episode.transitions";
static const char __pyx_k_MinariDataset___len[] = "MinariDataset.__len__";
static const char __pyx_k_TransitionMiniBatch[] = "TransitionMiniBatch";
static const char __pyx_k_environment_stack_2[] = "_environment_stack";
static const char __pyx_k_episode_terminals_2[] = "_episode_terminals";
static const char __pyx_k_Episode_observations[] = "Episode.observations";
static const char __pyx_k_MINARI_DATASETS_PATH[] = "MINARI_DATASETS_PATH";
static const char __pyx_k_MinariDataset___init[] = "MinariDataset.__init__";
static const char __pyx_k_MinariDataset___iter[] = "MinariDataset.__iter__";
static const char __pyx_k_MinariDataset_append[] = "MinariDataset.append";
static const char __pyx_k_MinariDataset_author[] = "MinariDataset.author";
static const char __pyx_k_MinariDataset_extend[] = "MinariDataset.extend";
static const char __pyx_k_trace_back_and_clear[] = "trace_back_and_clear";
static const char __pyx_k_MinariDataset_actions[] = "MinariDataset.actions";
static const char __pyx_k_MinariDataset_rewards[] = "MinariDataset.rewards";
static const char __pyx_k_check_discrete_action[] = "_check_discrete_action";
static const char __pyx_k_get_observation_shape[] = "get_observation_shape";
static const char __pyx_k_Episode_compute_return[] = "Episode.compute_return";
static const char __pyx_k_MinariDataset_episodes[] = "MinariDataset.episodes";
static const char __pyx_k_Transition_clear_links[] = "Transition.clear_links";
static const char __pyx_k_Episode_get_action_size[] = "Episode.get_action_size";
static const char __pyx_k_MinariDataset___getitem[] = "MinariDataset.__getitem__";
static const char __pyx_k_MinariDataset_seed_used[] = "MinariDataset.seed_used";
static const char __pyx_k_TransitionMiniBatch_size[] = "TransitionMiniBatch.size";
static const char __pyx_k_Episode_build_transitions[] = "Episode.build_transitions";
static const char __pyx_k_MinariDataset_truncations[] = "MinariDataset.truncations";
static const char __pyx_k_Observation_shape_must_be[] = "Observation shape must be ";
static const char __pyx_k_MinariDataset_author_email[] = "MinariDataset.author_email";
static const char __pyx_k_MinariDataset_dataset_name[] = "MinariDataset.dataset_name";
static const char __pyx_k_MinariDataset_observations[] = "MinariDataset.observations";
static const char __pyx_k_MinariDataset_terminations[] = "MinariDataset.terminations";
static const char __pyx_k_Transition___reduce_cython[] = "Transition.__reduce_cython__";
static const char __pyx_k_Transition_get_action_size[] = "Transition.get_action_size";
static const char __pyx_k_MinariDataset_compute_stats[] = "MinariDataset.compute_stats";
static const char __pyx_k_MinariDataset_algorithm_name[] = "MinariDataset.algorithm_name";
static const char __pyx_k_MinariDataset_build_episodes[] = "MinariDataset.build_episodes";
static const char __pyx_k_MinariDataset_code_permalink[] = "MinariDataset.code_permalink";
static const char __pyx_k_Transition___setstate_cython[] = "Transition.__setstate_cython__";
static const char __pyx_k_Episode_get_observation_shape[] = "Episode.get_observation_shape";
static const char __pyx_k_MinariDataset_get_action_size[] = "MinariDataset.get_action_size";
static const char __pyx_k_MinariDataset_environment_name[] = "MinariDataset.environment_name";
static const char __pyx_k_New_action_size_is_higher_than[] = "New action size is higher than ";
static const char __pyx_k_Episode_class_This_class_is_des[] = " Episode class.\n\n    This class is designed to hold data collected in a single episode.\n\n    Episode object automatically splits data into list of\n    :class:`minari.dataset.Transition` objects.\n    Also Episode object behaves like a list object for ease of access to\n    transitions.\n\n    .. code-block:: python\n\n        # return the number of transitions\n        len(episode)\n\n        # access to the first transition\n        transitions = episode[0]\n\n        # iterate through all transitions\n        for transition in episode:\n            pass\n\n    Args:\n        observation_shape (tuple): observation shape.\n        action_size (int): dimension of action-space.\n        observations (numpy.ndarray): observations.\n        actions (numpy.ndarray): actions.\n        rewards (numpy.ndarray): scalar rewards.\n        terminal (bool): binary terminal flag. If False, the episode is not\n            terminated by the environment (e.g. timeout).\n\n    ";
static const char __pyx_k_Image_observation_must_be_uint8[] = "Image observation must be uint8 array.";
static const char __pyx_k_Markov_Decision_Process_Dataset[] = " Markov-Decision Process Dataset class.\n\n    MinariDataset is deisnged for reinforcement learning datasets to use them like\n    supervised learning datasets.\n\n    .. code-block:: python\n\n        from minari.dataset import MinariDataset\n\n        # 1000 steps of observations with shape of (100,)\n        observations = np.random.random((1000, 100))\n        # 1000 steps of actions with shape of (4,)\n        actions = np.random.random((1000, 4))\n        # 1000 steps of rewards\n        rewards = np.random.random(1000)\n        # 1000 steps of terminal flags\n        terminals = np.random.randint(2, size=1000)\n\n        dataset = MinariDataset(observations, actions, rewards, terminals)\n\n    The MinariDataset object automatically splits the given data into list of\n    :class:`minari.dataset.Episode` objects.\n    Furthermore, the MinariDataset object behaves like a list in order to use with\n    scikit-learn utilities.\n\n    .. code-block:: python\n\n        # returns the number of episodes\n        len(dataset)\n\n        # access to the first episode\n        episode = dataset[0]\n\n        # iterate through all episodes\n        for episode in dataset:\n            pass\n\n    Args:\n        observations (numpy.ndarray): N-D array. If the\n            observation is a vector, the shape should be\n            `(N, dim_observation)`. If the observations is an image, the shape\n            should be `(N, C, H, W)`.\n        actions (numpy.ndarray): N-D array. If the actions-space is\n            continuous, the shape should be `(N, dim_action)`. If the\n            action-space is discrete, the shape should be `(N,)`.\n        rewards (numpy.ndarray): array of scalar rewards. The reward function\n            should be defined as :math:`r_t = r(s_t, a_t)`.\n        terminals (numpy.ndarray): array of binary terminal flags.\n        episode_terminals (numpy.ndarray): array of binary episode terminal\n            flags. The given data will be split based on ""this flag.\n            This is useful if you want to specify the non-environment\n            terminations (e.g. timeout). If ``None``, the episode terminations\n            match the environment terminations.\n        discrete_action (bool): flag to use the given actions as discrete\n            action-space actions. If ``None``, the action type is automatically\n            determined.\n\n    ";
static const char __pyx_k_MinariDataset_environment_stack[] = "MinariDataset.environment_stack";
static const char __pyx_k_MinariDataset_episode_terminals[] = "MinariDataset.episode_terminals";
static const char __pyx_k_Observation_must_be_numpy_array[] = "Observation must be numpy array.";
static const char __pyx_k_author_email_is_set_to_None_For[] = "`author_email` is set to None. For longevity purposes it is highly recommended to provide an author email, or some other obvious contact information.";
static const char __pyx_k_author_is_set_to_None_For_longe[] = "`author` is set to None. For longevity purposes it is highly recommended to provide an author name.";
static const char __pyx_k_code_permalink_is_set_to_None_F[] = "`code_permalink` is set to None. For reproducibility purposes it is highly recommended to link your dataset to versioned code.";
static const char __pyx_k_environment_stack_is_set_to_Non[] = "`environment_stack` is set to None. For reproducibility purposes it is highly recommended to provide the environment stack.";
static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
static const char __pyx_k_Dataset_must_have_discrete_actio[] = "Dataset must have discrete action-space.";
static const char __pyx_k_MinariDataset_get_observation_sh[] = "MinariDataset.get_observation_shape";
static const char __pyx_k_MinariDataset_is_action_discrete[] = "MinariDataset.is_action_discrete";
static const char __pyx_k_Observations_must_be_numpy_array[] = "Observations must be numpy array.";
static const char __pyx_k_The_dataset_structure_might_be_i[] = "The dataset structure might be incompatible.";
static const char __pyx_k_TransitionMiniBatch___reduce_cyt[] = "TransitionMiniBatch.__reduce_cython__";
static const char __pyx_k_TransitionMiniBatch___setstate_c[] = "TransitionMiniBatch.__setstate_cython__";
static const char __pyx_k_Transition_get_observation_shape[] = "Transition.get_observation_shape";
static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
static PyObject *__pyx_kp_s_1_0;
static PyObject *__pyx_kp_u_Action_size_must_be;
static PyObject *__pyx_kp_s_Dataset_must_have_discrete_actio;
static PyObject *__pyx_n_s_Episode;
static PyObject *__pyx_n_s_Episode___getitem;
static PyObject *__pyx_n_s_Episode___init;
static PyObject *__pyx_n_s_Episode___iter;
static PyObject *__pyx_n_s_Episode___len;
static PyObject *__pyx_n_s_Episode_actions;
static PyObject *__pyx_n_s_Episode_build_transitions;
static PyObject *__pyx_kp_s_Episode_class_This_class_is_des;
static PyObject *__pyx_n_s_Episode_compute_return;
static PyObject *__pyx_n_s_Episode_get_action_size;
static PyObject *__pyx_n_s_Episode_get_observation_shape;
static PyObject *__pyx_n_s_Episode_observations;
static PyObject *__pyx_n_s_Episode_rewards;
static PyObject *__pyx_n_s_Episode_size;
static PyObject *__pyx_n_s_Episode_termination;
static PyObject *__pyx_n_s_Episode_transitions;
static PyObject *__pyx_n_s_Episode_truncation;
static PyObject *__pyx_n_s_File;
static PyObject *__pyx_kp_s_Image_observation_must_be_uint8;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_n_s_LOG;
static PyObject *__pyx_n_s_MINARI_DATASETS_PATH;
static PyObject *__pyx_kp_s_Markov_Decision_Process_Dataset;
static PyObject *__pyx_n_s_MinariDataset;
static PyObject *__pyx_n_s_MinariDataset___getitem;
static PyObject *__pyx_n_s_MinariDataset___init;
static PyObject *__pyx_n_s_MinariDataset___iter;
static PyObject *__pyx_n_s_MinariDataset___len;
static PyObject *__pyx_n_s_MinariDataset_actions;
static PyObject *__pyx_n_s_MinariDataset_algorithm_name;
static PyObject *__pyx_n_s_MinariDataset_append;
static PyObject *__pyx_n_s_MinariDataset_author;
static PyObject *__pyx_n_s_MinariDataset_author_email;
static PyObject *__pyx_n_s_MinariDataset_build_episodes;
static PyObject *__pyx_n_s_MinariDataset_code_permalink;
static PyObject *__pyx_n_s_MinariDataset_compute_stats;
static PyObject *__pyx_n_s_MinariDataset_dataset_name;
static PyObject *__pyx_n_s_MinariDataset_environment_name;
static PyObject *__pyx_n_s_MinariDataset_environment_stack;
static PyObject *__pyx_n_s_MinariDataset_episode_terminals;
static PyObject *__pyx_n_s_MinariDataset_episodes;
static PyObject *__pyx_n_s_MinariDataset_extend;
static PyObject *__pyx_n_s_MinariDataset_get_action_size;
static PyObject *__pyx_n_s_MinariDataset_get_observation_sh;
static PyObject *__pyx_n_s_MinariDataset_is_action_discrete;
static PyObject *__pyx_n_s_MinariDataset_load;
static PyObject *__pyx_n_s_MinariDataset_observations;
static PyObject *__pyx_n_s_MinariDataset_rewards;
static PyObject *__pyx_n_s_MinariDataset_save;
static PyObject *__pyx_n_s_MinariDataset_seed_used;
static PyObject *__pyx_n_s_MinariDataset_size;
static PyObject *__pyx_n_s_MinariDataset_terminations;
static PyObject *__pyx_n_s_MinariDataset_truncations;
static PyObject *__pyx_kp_u_New_action_size_is_higher_than;
static PyObject *__pyx_kp_s_Observation_must_be_numpy_array;
static PyObject *__pyx_kp_u_Observation_shape_must_be;
static PyObject *__pyx_kp_s_Observations_must_be_numpy_array;
static PyObject *__pyx_n_s_Path;
static PyObject *__pyx_kp_s_The_dataset_structure_might_be_i;
static PyObject *__pyx_n_s_Transition;
static PyObject *__pyx_n_s_TransitionMiniBatch;
static PyObject *__pyx_n_s_TransitionMiniBatch___reduce_cyt;
static PyObject *__pyx_n_s_TransitionMiniBatch___setstate_c;
static PyObject *__pyx_n_s_TransitionMiniBatch_size;
static PyObject *__pyx_n_s_Transition___reduce_cython;
static PyObject *__pyx_n_s_Transition___setstate_cython;
static PyObject *__pyx_n_s_Transition_clear_links;
static PyObject *__pyx_n_s_Transition_get_action_size;
static PyObject *__pyx_n_s_Transition_get_observation_shape;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_UserWarning;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_kp_u__32;
static PyObject *__pyx_kp_s__35;
static PyObject *__pyx_n_s_action;
static PyObject *__pyx_n_s_action_size;
static PyObject *__pyx_n_s_actions;
static PyObject *__pyx_n_s_actions_2;
static PyObject *__pyx_n_s_algorithm_name;
static PyObject *__pyx_n_s_algorithm_name_2;
static PyObject *__pyx_n_s_all;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_arange;
static PyObject *__pyx_n_s_array;
static PyObject *__pyx_n_s_asarray;
static PyObject *__pyx_n_s_author;
static PyObject *__pyx_n_s_author_2;
static PyObject *__pyx_n_s_author_email;
static PyObject *__pyx_n_s_author_email_2;
static PyObject *__pyx_kp_s_author_email_is_set_to_None_For;
static PyObject *__pyx_kp_s_author_is_set_to_None_For_longe;
static PyObject *__pyx_n_s_axis;
static PyObject *__pyx_n_s_bins;
static PyObject *__pyx_n_s_build_episodes;
static PyObject *__pyx_n_s_build_transitions;
static PyObject *__pyx_n_s_check_discrete_action;
static PyObject *__pyx_n_s_clear_links;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_cls;
static PyObject *__pyx_n_s_code_permalink;
static PyObject *__pyx_n_s_code_permalink_2;
static PyObject *__pyx_kp_s_code_permalink_is_set_to_None_F;
static PyObject *__pyx_n_s_compute_return;
static PyObject *__pyx_n_s_compute_stats;
static PyObject *__pyx_n_s_create_dataset;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_dataset;
static PyObject *__pyx_n_s_dataset_name;
static PyObject *__pyx_n_s_dataset_name_2;
static PyObject *__pyx_n_s_datasets;
static PyObject *__pyx_n_s_datasets_path;
static PyObject *__pyx_n_s_discrete_action;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_dtype;
static PyObject *__pyx_n_s_empty;
static PyObject *__pyx_n_s_enter;
static PyObject *__pyx_n_s_environ;
static PyObject *__pyx_n_s_environment_name;
static PyObject *__pyx_n_s_environment_name_2;
static PyObject *__pyx_n_s_environment_stack;
static PyObject *__pyx_n_s_environment_stack_2;
static PyObject *__pyx_kp_s_environment_stack_is_set_to_Non;
static PyObject *__pyx_n_s_episode;
static PyObject *__pyx_n_s_episode_returns;
static PyObject *__pyx_n_s_episode_terminals;
static PyObject *__pyx_n_s_episode_terminals_2;
static PyObject *__pyx_n_s_episodes;
static PyObject *__pyx_n_s_episodes_2;
static PyObject *__pyx_n_s_exist_ok;
static PyObject *__pyx_n_s_exit;
static PyObject *__pyx_n_s_expanduser;
static PyObject *__pyx_n_s_extend;
static PyObject *__pyx_n_s_f;
static PyObject *__pyx_n_s_file_path;
static PyObject *__pyx_n_s_float32;
static PyObject *__pyx_n_s_float_actions;
static PyObject *__pyx_n_s_flush;
static PyObject *__pyx_n_s_fname;
static PyObject *__pyx_n_s_freqs;
static PyObject *__pyx_n_s_gamma;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_get_action_size;
static PyObject *__pyx_n_s_get_observation_shape;
static PyObject *__pyx_n_s_getitem;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_h5py;
static PyObject *__pyx_kp_u_hdf5;
static PyObject *__pyx_n_s_head_index;
static PyObject *__pyx_n_s_histogram;
static PyObject *__pyx_n_s_hists;
static PyObject *__pyx_n_s_hstack;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_int32;
static PyObject *__pyx_n_s_int_actions;
static PyObject *__pyx_n_s_is_action_discrete;
static PyObject *__pyx_n_s_isnan;
static PyObject *__pyx_n_s_iter;
static PyObject *__pyx_n_s_join;
static PyObject *__pyx_n_s_len;
static PyObject *__pyx_n_s_load;
static PyObject *__pyx_n_s_logger;
static PyObject *__pyx_n_s_logical_not;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_makedirs;
static PyObject *__pyx_n_s_max;
static PyObject *__pyx_n_s_mean;
static PyObject *__pyx_n_s_message;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_min;
static PyObject *__pyx_kp_s_minari;
static PyObject *__pyx_n_s_minari_dataset;
static PyObject *__pyx_kp_s_minari_dataset_pyx;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_n_frames;
static PyObject *__pyx_n_s_n_steps;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_next_observation;
static PyObject *__pyx_n_s_next_transition;
static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
static PyObject *__pyx_n_s_np;
static PyObject *__pyx_n_s_num_data;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
static PyObject *__pyx_n_s_observation;
static PyObject *__pyx_n_s_observation_shape;
static PyObject *__pyx_n_s_observations;
static PyObject *__pyx_n_s_observations_2;
static PyObject *__pyx_n_s_os;
static PyObject *__pyx_n_s_path;
static PyObject *__pyx_n_s_pathlib;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_prev_transition;
static PyObject *__pyx_n_s_property;
static PyObject *__pyx_n_s_pyx_state;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_r;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_reshape;
static PyObject *__pyx_n_s_rets;
static PyObject *__pyx_n_s_return;
static PyObject *__pyx_n_s_reward;
static PyObject *__pyx_n_s_rewards;
static PyObject *__pyx_n_s_rewards_2;
static PyObject *__pyx_n_s_safe_size;
static PyObject *__pyx_n_s_save;
static PyObject *__pyx_n_s_seed_used;
static PyObject *__pyx_n_s_seed_used_2;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_shape;
static PyObject *__pyx_n_s_size;
static PyObject *__pyx_n_s_stats;
static PyObject *__pyx_n_s_std;
static PyObject *__pyx_kp_s_stringsource;
static PyObject *__pyx_n_s_sum;
static PyObject *__pyx_n_s_termination;
static PyObject *__pyx_n_s_termination_2;
static PyObject *__pyx_n_s_terminations;
static PyObject *__pyx_n_s_terminations_2;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_to_episodes;
static PyObject *__pyx_n_s_to_transitions;
static PyObject *__pyx_n_s_trace_back_and_clear;
static PyObject *__pyx_n_s_transition;
static PyObject *__pyx_n_s_transitions;
static PyObject *__pyx_n_s_transitions_2;
static PyObject *__pyx_n_s_truncation;
static PyObject *__pyx_n_s_truncation_2;
static PyObject *__pyx_n_s_truncations;
static PyObject *__pyx_n_s_truncations_2;
static PyObject *__pyx_n_s_uint8;
static PyObject *__pyx_n_s_version;
static PyObject *__pyx_n_s_vstack;
static PyObject *__pyx_n_s_w;
static PyObject *__pyx_n_s_warn;
static PyObject *__pyx_n_s_warning;
static PyObject *__pyx_n_s_warnings;
static PyObject *__pyx_n_s_zeros_like;
static PyObject *__pyx_n_s_zip;
static PyObject *__pyx_pf_6minari_7dataset__safe_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_array); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_2_to_episodes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_observation_shape, PyObject *__pyx_v_action_size, PyObject *__pyx_v_observations, PyObject *__pyx_v_actions, PyObject *__pyx_v_rewards, PyObject *__pyx_v_terminations, PyObject *__pyx_v_truncations, PyObject *__pyx_v_episode_terminals); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_4_to_transitions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_observation_shape, PyObject *__pyx_v_action_size, PyObject *__pyx_v_observations, PyObject *__pyx_v_actions, PyObject *__pyx_v_rewards, PyObject *__pyx_v_termination, PyObject *__pyx_v_truncation); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_6_check_discrete_action(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_actions); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_dataset_name, PyObject *__pyx_v_algorithm_name, PyObject *__pyx_v_environment_name, PyObject *__pyx_v_environment_stack, PyObject *__pyx_v_seed_used, PyObject *__pyx_v_code_permalink, PyObject *__pyx_v_author, PyObject *__pyx_v_author_email, PyObject *__pyx_v_observations, PyObject *__pyx_v_actions, PyObject *__pyx_v_rewards, PyObject *__pyx_v_terminations, PyObject *__pyx_v_truncations, PyObject *__pyx_v_episode_terminals, PyObject *__pyx_v_discrete_action); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_2dataset_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_4algorithm_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_6environment_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_8environment_stack(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_10seed_used(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_12code_permalink(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_14author(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_16author_email(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_18observations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_20actions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_22rewards(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_24terminations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_26truncations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_28episode_terminals(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_30episodes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_32size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_34get_action_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_36get_observation_shape(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_38is_action_discrete(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_40compute_stats(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_42append(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_observations, PyObject *__pyx_v_actions, PyObject *__pyx_v_rewards, PyObject *__pyx_v_terminations, PyObject *__pyx_v_truncations, PyObject *__pyx_v_episode_terminals); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_44extend(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_dataset); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_46save(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_48load(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_fname); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_50build_episodes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_52__len__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_54__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_56__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_7Episode___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_observation_shape, PyObject *__pyx_v_action_size, PyObject *__pyx_v_observations, PyObject *__pyx_v_actions, PyObject *__pyx_v_rewards, PyObject *__pyx_v_termination, PyObject *__pyx_v_truncation); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_7Episode_2observations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_7Episode_4actions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_7Episode_6rewards(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_7Episode_8termination(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_7Episode_10truncation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_7Episode_12transitions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_7Episode_14build_transitions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_7Episode_16size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_7Episode_18get_observation_shape(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_7Episode_20get_action_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_7Episode_22compute_return(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_7Episode_24__len__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_7Episode_26__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_7Episode_28__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static int __pyx_pf_6minari_7dataset_10Transition___cinit__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self, std::vector<int>  __pyx_v_observation_shape, int __pyx_v_action_size, PyArrayObject *__pyx_v_observation, PyObject *__pyx_v_action, float __pyx_v_reward, PyArrayObject *__pyx_v_next_observation, float __pyx_v_termination, float __pyx_v_truncation, struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_prev_transition, struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_next_transition); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_10Transition_2get_observation_shape(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_10Transition_4get_action_size(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_10Transition_11is_discrete___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_10Transition_11observation___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_10Transition_6action___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_10Transition_6reward___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_10Transition_16next_observation___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_10Transition_11termination___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_10Transition_10truncation___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_10Transition_15prev_transition___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self); /* proto */
static int __pyx_pf_6minari_7dataset_10Transition_15prev_transition_2__set__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self, struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_transition); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_10Transition_15next_transition___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self); /* proto */
static int __pyx_pf_6minari_7dataset_10Transition_15next_transition_2__set__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self, struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_transition); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_10Transition_6clear_links(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_10Transition_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_10Transition_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_8trace_back_and_clear(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_transition); /* proto */
static int __pyx_pf_6minari_7dataset_19TransitionMiniBatch___cinit__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self, PyObject *__pyx_v_transitions, int __pyx_v_n_frames, int __pyx_v_n_steps, float __pyx_v_gamma); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_12observations___get__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_7actions___get__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_7rewards___get__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_17next_observations___get__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_12terminations___get__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_11truncations___get__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_7n_steps___get__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_11transitions___get__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_2size(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_6minari_7dataset_19TransitionMiniBatch_4__len__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_6__getitem__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_8__iter__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_6minari_7dataset_Transition(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6minari_7dataset_TransitionMiniBatch(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_20;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_codeobj_;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_slice__30;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__77;
static PyObject *__pyx_tuple__79;
static PyObject *__pyx_tuple__83;
static PyObject *__pyx_tuple__85;
static PyObject *__pyx_tuple__86;
static PyObject *__pyx_tuple__87;
static PyObject *__pyx_tuple__88;
static PyObject *__pyx_tuple__89;
static PyObject *__pyx_tuple__90;
static PyObject *__pyx_tuple__91;
static PyObject *__pyx_tuple__92;
static PyObject *__pyx_tuple__93;
static PyObject *__pyx_tuple__94;
static PyObject *__pyx_tuple__95;
static PyObject *__pyx_tuple__96;
static PyObject *__pyx_tuple__97;
static PyObject *__pyx_tuple__98;
static PyObject *__pyx_tuple__99;
static PyObject *__pyx_codeobj__2;
static PyObject *__pyx_codeobj__3;
static PyObject *__pyx_codeobj__4;
static PyObject *__pyx_codeobj__5;
static PyObject *__pyx_tuple__100;
static PyObject *__pyx_tuple__101;
static PyObject *__pyx_tuple__102;
static PyObject *__pyx_tuple__103;
static PyObject *__pyx_tuple__104;
static PyObject *__pyx_tuple__105;
static PyObject *__pyx_tuple__106;
static PyObject *__pyx_tuple__107;
static PyObject *__pyx_tuple__108;
static PyObject *__pyx_tuple__109;
static PyObject *__pyx_tuple__110;
static PyObject *__pyx_tuple__111;
static PyObject *__pyx_tuple__112;
static PyObject *__pyx_tuple__113;
static PyObject *__pyx_tuple__114;
static PyObject *__pyx_tuple__115;
static PyObject *__pyx_tuple__116;
static PyObject *__pyx_tuple__117;
static PyObject *__pyx_tuple__118;
static PyObject *__pyx_tuple__119;
static PyObject *__pyx_tuple__120;
static PyObject *__pyx_tuple__121;
static PyObject *__pyx_tuple__122;
static PyObject *__pyx_tuple__123;
static PyObject *__pyx_tuple__124;
static PyObject *__pyx_tuple__125;
static PyObject *__pyx_tuple__126;
static PyObject *__pyx_tuple__127;
static PyObject *__pyx_tuple__128;
static PyObject *__pyx_tuple__129;
static PyObject *__pyx_tuple__130;
static PyObject *__pyx_tuple__131;
static PyObject *__pyx_tuple__132;
static PyObject *__pyx_tuple__133;
static PyObject *__pyx_tuple__134;
static PyObject *__pyx_tuple__135;
static PyObject *__pyx_tuple__136;
static PyObject *__pyx_tuple__137;
static PyObject *__pyx_tuple__138;
static PyObject *__pyx_tuple__139;
static PyObject *__pyx_tuple__140;
static PyObject *__pyx_tuple__141;
static PyObject *__pyx_tuple__142;
static PyObject *__pyx_tuple__143;
static PyObject *__pyx_tuple__144;
static PyObject *__pyx_tuple__145;
static PyObject *__pyx_tuple__146;
static PyObject *__pyx_tuple__147;
static PyObject *__pyx_codeobj__10;
static PyObject *__pyx_codeobj__11;
static PyObject *__pyx_codeobj__12;
static PyObject *__pyx_codeobj__13;
static PyObject *__pyx_codeobj__14;
static PyObject *__pyx_codeobj__15;
static PyObject *__pyx_codeobj__16;
static PyObject *__pyx_codeobj__17;
static PyObject *__pyx_codeobj__18;
static PyObject *__pyx_codeobj__19;
static PyObject *__pyx_codeobj__20;
static PyObject *__pyx_codeobj__21;
static PyObject *__pyx_codeobj__22;
static PyObject *__pyx_codeobj__23;
static PyObject *__pyx_codeobj__24;
static PyObject *__pyx_codeobj__25;
static PyObject *__pyx_codeobj__26;
static PyObject *__pyx_codeobj__27;
static PyObject *__pyx_codeobj__28;
static PyObject *__pyx_codeobj__29;
static PyObject *__pyx_codeobj__31;
static PyObject *__pyx_codeobj__33;
static PyObject *__pyx_codeobj__34;
static PyObject *__pyx_codeobj__53;
static PyObject *__pyx_codeobj__54;
static PyObject *__pyx_codeobj__55;
static PyObject *__pyx_codeobj__56;
static PyObject *__pyx_codeobj__57;
static PyObject *__pyx_codeobj__58;
static PyObject *__pyx_codeobj__59;
static PyObject *__pyx_codeobj__60;
static PyObject *__pyx_codeobj__61;
static PyObject *__pyx_codeobj__62;
static PyObject *__pyx_codeobj__63;
static PyObject *__pyx_codeobj__64;
static PyObject *__pyx_codeobj__65;
static PyObject *__pyx_codeobj__66;
static PyObject *__pyx_codeobj__67;
static PyObject *__pyx_codeobj__68;
static PyObject *__pyx_codeobj__69;
static PyObject *__pyx_codeobj__70;
static PyObject *__pyx_codeobj__71;
static PyObject *__pyx_codeobj__72;
static PyObject *__pyx_codeobj__73;
static PyObject *__pyx_codeobj__74;
static PyObject *__pyx_codeobj__75;
static PyObject *__pyx_codeobj__76;
static PyObject *__pyx_codeobj__78;
static PyObject *__pyx_codeobj__80;
static PyObject *__pyx_codeobj__81;
static PyObject *__pyx_codeobj__82;
static PyObject *__pyx_codeobj__84;
/* Late includes */

/* "minari/dataset.pyx":35
 * 
 * 
 * def _safe_size(array):             # <<<<<<<<<<<<<<
 *     if isinstance(array, (list, tuple)):
 *         return len(array)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_1_safe_size(PyObject *__pyx_self, PyObject *__pyx_v_array); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_1_safe_size = {"_safe_size", (PyCFunction)__pyx_pw_6minari_7dataset_1_safe_size, METH_O, 0};
static PyObject *__pyx_pw_6minari_7dataset_1_safe_size(PyObject *__pyx_self, PyObject *__pyx_v_array) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_safe_size (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset__safe_size(__pyx_self, ((PyObject *)__pyx_v_array));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset__safe_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_array) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj_)
  __Pyx_RefNannySetupContext("_safe_size", 0);
  __Pyx_TraceCall("_safe_size", __pyx_f[0], 35, 0, __PYX_ERR(0, 35, __pyx_L1_error));

  /* "minari/dataset.pyx":36
 * 
 * def _safe_size(array):
 *     if isinstance(array, (list, tuple)):             # <<<<<<<<<<<<<<
 *         return len(array)
 *     elif isinstance(array, np.ndarray):
 */
  __Pyx_TraceLine(36,0,__PYX_ERR(0, 36, __pyx_L1_error))
  __pyx_t_2 = PyList_Check(__pyx_v_array); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyTuple_Check(__pyx_v_array); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "minari/dataset.pyx":37
 * def _safe_size(array):
 *     if isinstance(array, (list, tuple)):
 *         return len(array)             # <<<<<<<<<<<<<<
 *     elif isinstance(array, np.ndarray):
 *         return array.shape[0]
 */
    __Pyx_TraceLine(37,0,__PYX_ERR(0, 37, __pyx_L1_error))
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyObject_Length(__pyx_v_array); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 37, __pyx_L1_error)
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "minari/dataset.pyx":36
 * 
 * def _safe_size(array):
 *     if isinstance(array, (list, tuple)):             # <<<<<<<<<<<<<<
 *         return len(array)
 *     elif isinstance(array, np.ndarray):
 */
  }

  /* "minari/dataset.pyx":38
 *     if isinstance(array, (list, tuple)):
 *         return len(array)
 *     elif isinstance(array, np.ndarray):             # <<<<<<<<<<<<<<
 *         return array.shape[0]
 *     raise ValueError
 */
  __Pyx_TraceLine(38,0,__PYX_ERR(0, 38, __pyx_L1_error))
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_array, __pyx_ptype_5numpy_ndarray); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "minari/dataset.pyx":39
 *         return len(array)
 *     elif isinstance(array, np.ndarray):
 *         return array.shape[0]             # <<<<<<<<<<<<<<
 *     raise ValueError
 * 
 */
    __Pyx_TraceLine(39,0,__PYX_ERR(0, 39, __pyx_L1_error))
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_array, __pyx_n_s_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "minari/dataset.pyx":38
 *     if isinstance(array, (list, tuple)):
 *         return len(array)
 *     elif isinstance(array, np.ndarray):             # <<<<<<<<<<<<<<
 *         return array.shape[0]
 *     raise ValueError
 */
  }

  /* "minari/dataset.pyx":40
 *     elif isinstance(array, np.ndarray):
 *         return array.shape[0]
 *     raise ValueError             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_TraceLine(40,0,__PYX_ERR(0, 40, __pyx_L1_error))
  __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0);
  __PYX_ERR(0, 40, __pyx_L1_error)

  /* "minari/dataset.pyx":35
 * 
 * 
 * def _safe_size(array):             # <<<<<<<<<<<<<<
 *     if isinstance(array, (list, tuple)):
 *         return len(array)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("minari.dataset._safe_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":43
 * 
 * 
 * def _to_episodes(             # <<<<<<<<<<<<<<
 *     observation_shape,
 *     action_size,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_3_to_episodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_3_to_episodes = {"_to_episodes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6minari_7dataset_3_to_episodes, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6minari_7dataset_3_to_episodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_observation_shape = 0;
  PyObject *__pyx_v_action_size = 0;
  PyObject *__pyx_v_observations = 0;
  PyObject *__pyx_v_actions = 0;
  PyObject *__pyx_v_rewards = 0;
  PyObject *__pyx_v_terminations = 0;
  PyObject *__pyx_v_truncations = 0;
  PyObject *__pyx_v_episode_terminals = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_to_episodes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_observation_shape,&__pyx_n_s_action_size,&__pyx_n_s_observations,&__pyx_n_s_actions,&__pyx_n_s_rewards,&__pyx_n_s_terminations,&__pyx_n_s_truncations,&__pyx_n_s_episode_terminals,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_observation_shape)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_action_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_to_episodes", 1, 8, 8, 1); __PYX_ERR(0, 43, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_observations)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_to_episodes", 1, 8, 8, 2); __PYX_ERR(0, 43, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_actions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_to_episodes", 1, 8, 8, 3); __PYX_ERR(0, 43, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rewards)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_to_episodes", 1, 8, 8, 4); __PYX_ERR(0, 43, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_terminations)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_to_episodes", 1, 8, 8, 5); __PYX_ERR(0, 43, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_truncations)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_to_episodes", 1, 8, 8, 6); __PYX_ERR(0, 43, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_episode_terminals)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_to_episodes", 1, 8, 8, 7); __PYX_ERR(0, 43, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_to_episodes") < 0)) __PYX_ERR(0, 43, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
    }
    __pyx_v_observation_shape = values[0];
    __pyx_v_action_size = values[1];
    __pyx_v_observations = values[2];
    __pyx_v_actions = values[3];
    __pyx_v_rewards = values[4];
    __pyx_v_terminations = values[5];
    __pyx_v_truncations = values[6];
    __pyx_v_episode_terminals = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_to_episodes", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 43, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("minari.dataset._to_episodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6minari_7dataset_2_to_episodes(__pyx_self, __pyx_v_observation_shape, __pyx_v_action_size, __pyx_v_observations, __pyx_v_actions, __pyx_v_rewards, __pyx_v_terminations, __pyx_v_truncations, __pyx_v_episode_terminals);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_2_to_episodes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_observation_shape, PyObject *__pyx_v_action_size, PyObject *__pyx_v_observations, PyObject *__pyx_v_actions, PyObject *__pyx_v_rewards, PyObject *__pyx_v_terminations, PyObject *__pyx_v_truncations, PyObject *__pyx_v_episode_terminals) {
  PyObject *__pyx_v_rets = NULL;
  PyObject *__pyx_v_head_index = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_episode = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__2)
  __Pyx_RefNannySetupContext("_to_episodes", 0);
  __Pyx_TraceCall("_to_episodes", __pyx_f[0], 43, 0, __PYX_ERR(0, 43, __pyx_L1_error));

  /* "minari/dataset.pyx":53
 *     episode_terminals,
 * ):
 *     rets = []             # <<<<<<<<<<<<<<
 *     head_index = 0
 *     for i in range(_safe_size(observations)):
 */
  __Pyx_TraceLine(53,0,__PYX_ERR(0, 53, __pyx_L1_error))
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rets = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "minari/dataset.pyx":54
 * ):
 *     rets = []
 *     head_index = 0             # <<<<<<<<<<<<<<
 *     for i in range(_safe_size(observations)):
 *         if episode_terminals[i]:  # todo: check
 */
  __Pyx_TraceLine(54,0,__PYX_ERR(0, 54, __pyx_L1_error))
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_head_index = __pyx_int_0;

  /* "minari/dataset.pyx":55
 *     rets = []
 *     head_index = 0
 *     for i in range(_safe_size(observations)):             # <<<<<<<<<<<<<<
 *         if episode_terminals[i]:  # todo: check
 *             episode = Episode(
 */
  __Pyx_TraceLine(55,0,__PYX_ERR(0, 55, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_safe_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_observations) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_observations);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 55, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 55, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_5(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 55, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "minari/dataset.pyx":56
 *     head_index = 0
 *     for i in range(_safe_size(observations)):
 *         if episode_terminals[i]:  # todo: check             # <<<<<<<<<<<<<<
 *             episode = Episode(
 *                 observation_shape=observation_shape,
 */
    __Pyx_TraceLine(56,0,__PYX_ERR(0, 56, __pyx_L1_error))
    __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_episode_terminals, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_6) {

      /* "minari/dataset.pyx":57
 *     for i in range(_safe_size(observations)):
 *         if episode_terminals[i]:  # todo: check
 *             episode = Episode(             # <<<<<<<<<<<<<<
 *                 observation_shape=observation_shape,
 *                 action_size=action_size,
 */
      __Pyx_TraceLine(57,0,__PYX_ERR(0, 57, __pyx_L1_error))
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Episode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "minari/dataset.pyx":58
 *         if episode_terminals[i]:  # todo: check
 *             episode = Episode(
 *                 observation_shape=observation_shape,             # <<<<<<<<<<<<<<
 *                 action_size=action_size,
 *                 observations=observations[head_index:i + 1],
 */
      __Pyx_TraceLine(58,0,__PYX_ERR(0, 58, __pyx_L1_error))
      __pyx_t_3 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_observation_shape, __pyx_v_observation_shape) < 0) __PYX_ERR(0, 58, __pyx_L1_error)

      /* "minari/dataset.pyx":59
 *             episode = Episode(
 *                 observation_shape=observation_shape,
 *                 action_size=action_size,             # <<<<<<<<<<<<<<
 *                 observations=observations[head_index:i + 1],
 *                 actions=actions[head_index:i + 1],
 */
      __Pyx_TraceLine(59,0,__PYX_ERR(0, 59, __pyx_L1_error))
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_action_size, __pyx_v_action_size) < 0) __PYX_ERR(0, 58, __pyx_L1_error)

      /* "minari/dataset.pyx":60
 *                 observation_shape=observation_shape,
 *                 action_size=action_size,
 *                 observations=observations[head_index:i + 1],             # <<<<<<<<<<<<<<
 *                 actions=actions[head_index:i + 1],
 *                 rewards=rewards[head_index:i + 1],
 */
      __Pyx_TraceLine(60,0,__PYX_ERR(0, 60, __pyx_L1_error))
      __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 60, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_v_observations, 0, 0, &__pyx_v_head_index, &__pyx_t_7, NULL, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 60, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_observations, __pyx_t_8) < 0) __PYX_ERR(0, 58, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "minari/dataset.pyx":61
 *                 action_size=action_size,
 *                 observations=observations[head_index:i + 1],
 *                 actions=actions[head_index:i + 1],             # <<<<<<<<<<<<<<
 *                 rewards=rewards[head_index:i + 1],
 *                 termination=terminations[i],
 */
      __Pyx_TraceLine(61,0,__PYX_ERR(0, 61, __pyx_L1_error))
      __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 61, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_actions, 0, 0, &__pyx_v_head_index, &__pyx_t_8, NULL, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 61, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_actions, __pyx_t_7) < 0) __PYX_ERR(0, 58, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "minari/dataset.pyx":62
 *                 observations=observations[head_index:i + 1],
 *                 actions=actions[head_index:i + 1],
 *                 rewards=rewards[head_index:i + 1],             # <<<<<<<<<<<<<<
 *                 termination=terminations[i],
 *                 truncation=truncations[i]
 */
      __Pyx_TraceLine(62,0,__PYX_ERR(0, 62, __pyx_L1_error))
      __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 62, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_v_rewards, 0, 0, &__pyx_v_head_index, &__pyx_t_7, NULL, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 62, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rewards, __pyx_t_8) < 0) __PYX_ERR(0, 58, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "minari/dataset.pyx":63
 *                 actions=actions[head_index:i + 1],
 *                 rewards=rewards[head_index:i + 1],
 *                 termination=terminations[i],             # <<<<<<<<<<<<<<
 *                 truncation=truncations[i]
 *             )
 */
      __Pyx_TraceLine(63,0,__PYX_ERR(0, 63, __pyx_L1_error))
      __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_terminations, __pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 63, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_termination, __pyx_t_8) < 0) __PYX_ERR(0, 58, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "minari/dataset.pyx":64
 *                 rewards=rewards[head_index:i + 1],
 *                 termination=terminations[i],
 *                 truncation=truncations[i]             # <<<<<<<<<<<<<<
 *             )
 *             rets.append(episode)
 */
      __Pyx_TraceLine(64,0,__PYX_ERR(0, 64, __pyx_L1_error))
      __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_truncations, __pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_truncation, __pyx_t_8) < 0) __PYX_ERR(0, 58, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "minari/dataset.pyx":57
 *     for i in range(_safe_size(observations)):
 *         if episode_terminals[i]:  # todo: check
 *             episode = Episode(             # <<<<<<<<<<<<<<
 *                 observation_shape=observation_shape,
 *                 action_size=action_size,
 */
      __Pyx_TraceLine(57,0,__PYX_ERR(0, 57, __pyx_L1_error))
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 57, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_episode, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "minari/dataset.pyx":66
 *                 truncation=truncations[i]
 *             )
 *             rets.append(episode)             # <<<<<<<<<<<<<<
 *             head_index = i + 1
 *     return rets
 */
      __Pyx_TraceLine(66,0,__PYX_ERR(0, 66, __pyx_L1_error))
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_rets, __pyx_v_episode); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 66, __pyx_L1_error)

      /* "minari/dataset.pyx":67
 *             )
 *             rets.append(episode)
 *             head_index = i + 1             # <<<<<<<<<<<<<<
 *     return rets
 * 
 */
      __Pyx_TraceLine(67,0,__PYX_ERR(0, 67, __pyx_L1_error))
      __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 67, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF_SET(__pyx_v_head_index, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "minari/dataset.pyx":56
 *     head_index = 0
 *     for i in range(_safe_size(observations)):
 *         if episode_terminals[i]:  # todo: check             # <<<<<<<<<<<<<<
 *             episode = Episode(
 *                 observation_shape=observation_shape,
 */
    }

    /* "minari/dataset.pyx":55
 *     rets = []
 *     head_index = 0
 *     for i in range(_safe_size(observations)):             # <<<<<<<<<<<<<<
 *         if episode_terminals[i]:  # todo: check
 *             episode = Episode(
 */
    __Pyx_TraceLine(55,0,__PYX_ERR(0, 55, __pyx_L1_error))
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":68
 *             rets.append(episode)
 *             head_index = i + 1
 *     return rets             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_TraceLine(68,0,__PYX_ERR(0, 68, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rets);
  __pyx_r = __pyx_v_rets;
  goto __pyx_L0;

  /* "minari/dataset.pyx":43
 * 
 * 
 * def _to_episodes(             # <<<<<<<<<<<<<<
 *     observation_shape,
 *     action_size,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("minari.dataset._to_episodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rets);
  __Pyx_XDECREF(__pyx_v_head_index);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_episode);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":71
 * 
 * 
 * def _to_transitions(             # <<<<<<<<<<<<<<
 *     observation_shape,
 *     action_size,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_5_to_transitions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_5_to_transitions = {"_to_transitions", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6minari_7dataset_5_to_transitions, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6minari_7dataset_5_to_transitions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_observation_shape = 0;
  PyObject *__pyx_v_action_size = 0;
  PyObject *__pyx_v_observations = 0;
  PyObject *__pyx_v_actions = 0;
  PyObject *__pyx_v_rewards = 0;
  PyObject *__pyx_v_termination = 0;
  PyObject *__pyx_v_truncation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_to_transitions (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_observation_shape,&__pyx_n_s_action_size,&__pyx_n_s_observations,&__pyx_n_s_actions,&__pyx_n_s_rewards,&__pyx_n_s_termination,&__pyx_n_s_truncation,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_observation_shape)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_action_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_to_transitions", 1, 7, 7, 1); __PYX_ERR(0, 71, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_observations)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_to_transitions", 1, 7, 7, 2); __PYX_ERR(0, 71, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_actions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_to_transitions", 1, 7, 7, 3); __PYX_ERR(0, 71, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rewards)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_to_transitions", 1, 7, 7, 4); __PYX_ERR(0, 71, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_termination)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_to_transitions", 1, 7, 7, 5); __PYX_ERR(0, 71, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_truncation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_to_transitions", 1, 7, 7, 6); __PYX_ERR(0, 71, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_to_transitions") < 0)) __PYX_ERR(0, 71, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_observation_shape = values[0];
    __pyx_v_action_size = values[1];
    __pyx_v_observations = values[2];
    __pyx_v_actions = values[3];
    __pyx_v_rewards = values[4];
    __pyx_v_termination = values[5];
    __pyx_v_truncation = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_to_transitions", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 71, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("minari.dataset._to_transitions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6minari_7dataset_4_to_transitions(__pyx_self, __pyx_v_observation_shape, __pyx_v_action_size, __pyx_v_observations, __pyx_v_actions, __pyx_v_rewards, __pyx_v_termination, __pyx_v_truncation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_4_to_transitions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_observation_shape, PyObject *__pyx_v_action_size, PyObject *__pyx_v_observations, PyObject *__pyx_v_actions, PyObject *__pyx_v_rewards, PyObject *__pyx_v_termination, PyObject *__pyx_v_truncation) {
  PyObject *__pyx_v_rets = NULL;
  PyObject *__pyx_v_num_data = NULL;
  struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_prev_transition = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_observation = NULL;
  PyObject *__pyx_v_action = NULL;
  PyObject *__pyx_v_reward = NULL;
  PyObject *__pyx_v_next_observation = NULL;
  struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_transition = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__3)
  __Pyx_RefNannySetupContext("_to_transitions", 0);
  __Pyx_TraceCall("_to_transitions", __pyx_f[0], 71, 0, __PYX_ERR(0, 71, __pyx_L1_error));

  /* "minari/dataset.pyx":80
 *     truncation,
 * ):
 *     rets = []             # <<<<<<<<<<<<<<
 *     num_data = _safe_size(observations)
 *     prev_transition = None
 */
  __Pyx_TraceLine(80,0,__PYX_ERR(0, 80, __pyx_L1_error))
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rets = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "minari/dataset.pyx":81
 * ):
 *     rets = []
 *     num_data = _safe_size(observations)             # <<<<<<<<<<<<<<
 *     prev_transition = None
 *     for i in range(num_data):
 */
  __Pyx_TraceLine(81,0,__PYX_ERR(0, 81, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_safe_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_observations) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_observations);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_num_data = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "minari/dataset.pyx":82
 *     rets = []
 *     num_data = _safe_size(observations)
 *     prev_transition = None             # <<<<<<<<<<<<<<
 *     for i in range(num_data):
 *         observation = observations[i]
 */
  __Pyx_TraceLine(82,0,__PYX_ERR(0, 82, __pyx_L1_error))
  __Pyx_INCREF(Py_None);
  __pyx_v_prev_transition = ((struct __pyx_obj_6minari_7dataset_Transition *)Py_None);

  /* "minari/dataset.pyx":83
 *     num_data = _safe_size(observations)
 *     prev_transition = None
 *     for i in range(num_data):             # <<<<<<<<<<<<<<
 *         observation = observations[i]
 *         action = actions[i]
 */
  __Pyx_TraceLine(83,0,__PYX_ERR(0, 83, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 83, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 83, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 83, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "minari/dataset.pyx":84
 *     prev_transition = None
 *     for i in range(num_data):
 *         observation = observations[i]             # <<<<<<<<<<<<<<
 *         action = actions[i]
 *         reward = rewards[i]
 */
    __Pyx_TraceLine(84,0,__PYX_ERR(0, 84, __pyx_L1_error))
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_observations, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_observation, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "minari/dataset.pyx":85
 *     for i in range(num_data):
 *         observation = observations[i]
 *         action = actions[i]             # <<<<<<<<<<<<<<
 *         reward = rewards[i]
 * 
 */
    __Pyx_TraceLine(85,0,__PYX_ERR(0, 85, __pyx_L1_error))
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_actions, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_action, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "minari/dataset.pyx":86
 *         observation = observations[i]
 *         action = actions[i]
 *         reward = rewards[i]             # <<<<<<<<<<<<<<
 * 
 *         if i == num_data - 1:
 */
    __Pyx_TraceLine(86,0,__PYX_ERR(0, 86, __pyx_L1_error))
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_rewards, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_reward, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "minari/dataset.pyx":88
 *         reward = rewards[i]
 * 
 *         if i == num_data - 1:             # <<<<<<<<<<<<<<
 *             if termination or truncation:
 *                 # dummy observation
 */
    __Pyx_TraceLine(88,0,__PYX_ERR(0, 88, __pyx_L1_error))
    __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_v_num_data, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_i, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 88, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_6) {

      /* "minari/dataset.pyx":89
 * 
 *         if i == num_data - 1:
 *             if termination or truncation:             # <<<<<<<<<<<<<<
 *                 # dummy observation
 *                 next_observation = np.zeros_like(observation)
 */
      __Pyx_TraceLine(89,0,__PYX_ERR(0, 89, __pyx_L1_error))
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_termination); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 89, __pyx_L1_error)
      if (!__pyx_t_7) {
      } else {
        __pyx_t_6 = __pyx_t_7;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_truncation); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 89, __pyx_L1_error)
      __pyx_t_6 = __pyx_t_7;
      __pyx_L7_bool_binop_done:;
      if (__pyx_t_6) {

        /* "minari/dataset.pyx":91
 *             if termination or truncation:
 *                 # dummy observation
 *                 next_observation = np.zeros_like(observation)             # <<<<<<<<<<<<<<
 *             else:
 *                 # skip the last step if not terminated
 */
        __Pyx_TraceLine(91,0,__PYX_ERR(0, 91, __pyx_L1_error))
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 91, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_1, __pyx_v_observation) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_observation);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF_SET(__pyx_v_next_observation, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "minari/dataset.pyx":89
 * 
 *         if i == num_data - 1:
 *             if termination or truncation:             # <<<<<<<<<<<<<<
 *                 # dummy observation
 *                 next_observation = np.zeros_like(observation)
 */
        goto __pyx_L6;
      }

      /* "minari/dataset.pyx":94
 *             else:
 *                 # skip the last step if not terminated
 *                 break             # <<<<<<<<<<<<<<
 *         else:
 *             next_observation = observations[i + 1]
 */
      __Pyx_TraceLine(94,0,__PYX_ERR(0, 94, __pyx_L1_error))
      /*else*/ {
        goto __pyx_L4_break;
      }
      __pyx_L6:;

      /* "minari/dataset.pyx":88
 *         reward = rewards[i]
 * 
 *         if i == num_data - 1:             # <<<<<<<<<<<<<<
 *             if termination or truncation:
 *                 # dummy observation
 */
      goto __pyx_L5;
    }

    /* "minari/dataset.pyx":96
 *                 break
 *         else:
 *             next_observation = observations[i + 1]             # <<<<<<<<<<<<<<
 * 
 *         transition = Transition(
 */
    __Pyx_TraceLine(96,0,__PYX_ERR(0, 96, __pyx_L1_error))
    /*else*/ {
      __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_observations, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 96, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_next_observation, __pyx_t_8);
      __pyx_t_8 = 0;
    }
    __pyx_L5:;

    /* "minari/dataset.pyx":99
 * 
 *         transition = Transition(
 *             observation_shape=observation_shape,             # <<<<<<<<<<<<<<
 *             action_size=action_size,
 *             observation=observation,
 */
    __Pyx_TraceLine(99,0,__PYX_ERR(0, 99, __pyx_L1_error))
    __pyx_t_8 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_observation_shape, __pyx_v_observation_shape) < 0) __PYX_ERR(0, 99, __pyx_L1_error)

    /* "minari/dataset.pyx":100
 *         transition = Transition(
 *             observation_shape=observation_shape,
 *             action_size=action_size,             # <<<<<<<<<<<<<<
 *             observation=observation,
 *             action=action,
 */
    __Pyx_TraceLine(100,0,__PYX_ERR(0, 100, __pyx_L1_error))
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_action_size, __pyx_v_action_size) < 0) __PYX_ERR(0, 99, __pyx_L1_error)

    /* "minari/dataset.pyx":101
 *             observation_shape=observation_shape,
 *             action_size=action_size,
 *             observation=observation,             # <<<<<<<<<<<<<<
 *             action=action,
 *             reward=reward,
 */
    __Pyx_TraceLine(101,0,__PYX_ERR(0, 101, __pyx_L1_error))
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_observation, __pyx_v_observation) < 0) __PYX_ERR(0, 99, __pyx_L1_error)

    /* "minari/dataset.pyx":102
 *             action_size=action_size,
 *             observation=observation,
 *             action=action,             # <<<<<<<<<<<<<<
 *             reward=reward,
 *             next_observation=next_observation,
 */
    __Pyx_TraceLine(102,0,__PYX_ERR(0, 102, __pyx_L1_error))
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_action, __pyx_v_action) < 0) __PYX_ERR(0, 99, __pyx_L1_error)

    /* "minari/dataset.pyx":103
 *             observation=observation,
 *             action=action,
 *             reward=reward,             # <<<<<<<<<<<<<<
 *             next_observation=next_observation,
 *             termination=termination,
 */
    __Pyx_TraceLine(103,0,__PYX_ERR(0, 103, __pyx_L1_error))
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_reward, __pyx_v_reward) < 0) __PYX_ERR(0, 99, __pyx_L1_error)

    /* "minari/dataset.pyx":104
 *             action=action,
 *             reward=reward,
 *             next_observation=next_observation,             # <<<<<<<<<<<<<<
 *             termination=termination,
 *             truncation=truncation,
 */
    __Pyx_TraceLine(104,0,__PYX_ERR(0, 104, __pyx_L1_error))
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_next_observation, __pyx_v_next_observation) < 0) __PYX_ERR(0, 99, __pyx_L1_error)

    /* "minari/dataset.pyx":105
 *             reward=reward,
 *             next_observation=next_observation,
 *             termination=termination,             # <<<<<<<<<<<<<<
 *             truncation=truncation,
 *             prev_transition=prev_transition
 */
    __Pyx_TraceLine(105,0,__PYX_ERR(0, 105, __pyx_L1_error))
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_termination, __pyx_v_termination) < 0) __PYX_ERR(0, 99, __pyx_L1_error)

    /* "minari/dataset.pyx":106
 *             next_observation=next_observation,
 *             termination=termination,
 *             truncation=truncation,             # <<<<<<<<<<<<<<
 *             prev_transition=prev_transition
 *         )
 */
    __Pyx_TraceLine(106,0,__PYX_ERR(0, 106, __pyx_L1_error))
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_truncation, __pyx_v_truncation) < 0) __PYX_ERR(0, 99, __pyx_L1_error)

    /* "minari/dataset.pyx":107
 *             termination=termination,
 *             truncation=truncation,
 *             prev_transition=prev_transition             # <<<<<<<<<<<<<<
 *         )
 * 
 */
    __Pyx_TraceLine(107,0,__PYX_ERR(0, 107, __pyx_L1_error))
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_prev_transition, ((PyObject *)__pyx_v_prev_transition)) < 0) __PYX_ERR(0, 99, __pyx_L1_error)

    /* "minari/dataset.pyx":98
 *             next_observation = observations[i + 1]
 * 
 *         transition = Transition(             # <<<<<<<<<<<<<<
 *             observation_shape=observation_shape,
 *             action_size=action_size,
 */
    __Pyx_TraceLine(98,0,__PYX_ERR(0, 98, __pyx_L1_error))
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6minari_7dataset_Transition), __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_transition, ((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "minari/dataset.pyx":111
 * 
 *         # set pointer to the next transition
 *         if prev_transition:             # <<<<<<<<<<<<<<
 *             prev_transition.next_transition = transition
 * 
 */
    __Pyx_TraceLine(111,0,__PYX_ERR(0, 111, __pyx_L1_error))
    __pyx_t_6 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_prev_transition)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 111, __pyx_L1_error)
    if (__pyx_t_6) {

      /* "minari/dataset.pyx":112
 *         # set pointer to the next transition
 *         if prev_transition:
 *             prev_transition.next_transition = transition             # <<<<<<<<<<<<<<
 * 
 *         prev_transition = transition
 */
      __Pyx_TraceLine(112,0,__PYX_ERR(0, 112, __pyx_L1_error))
      if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_prev_transition), __pyx_n_s_next_transition, ((PyObject *)__pyx_v_transition)) < 0) __PYX_ERR(0, 112, __pyx_L1_error)

      /* "minari/dataset.pyx":111
 * 
 *         # set pointer to the next transition
 *         if prev_transition:             # <<<<<<<<<<<<<<
 *             prev_transition.next_transition = transition
 * 
 */
    }

    /* "minari/dataset.pyx":114
 *             prev_transition.next_transition = transition
 * 
 *         prev_transition = transition             # <<<<<<<<<<<<<<
 * 
 *         rets.append(transition)
 */
    __Pyx_TraceLine(114,0,__PYX_ERR(0, 114, __pyx_L1_error))
    __Pyx_INCREF(((PyObject *)__pyx_v_transition));
    __Pyx_DECREF_SET(__pyx_v_prev_transition, __pyx_v_transition);

    /* "minari/dataset.pyx":116
 *         prev_transition = transition
 * 
 *         rets.append(transition)             # <<<<<<<<<<<<<<
 *     return rets
 * 
 */
    __Pyx_TraceLine(116,0,__PYX_ERR(0, 116, __pyx_L1_error))
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_rets, ((PyObject *)__pyx_v_transition)); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 116, __pyx_L1_error)

    /* "minari/dataset.pyx":83
 *     num_data = _safe_size(observations)
 *     prev_transition = None
 *     for i in range(num_data):             # <<<<<<<<<<<<<<
 *         observation = observations[i]
 *         action = actions[i]
 */
    __Pyx_TraceLine(83,0,__PYX_ERR(0, 83, __pyx_L1_error))
  }
  __pyx_L4_break:;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":117
 * 
 *         rets.append(transition)
 *     return rets             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_TraceLine(117,0,__PYX_ERR(0, 117, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rets);
  __pyx_r = __pyx_v_rets;
  goto __pyx_L0;

  /* "minari/dataset.pyx":71
 * 
 * 
 * def _to_transitions(             # <<<<<<<<<<<<<<
 *     observation_shape,
 *     action_size,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("minari.dataset._to_transitions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rets);
  __Pyx_XDECREF(__pyx_v_num_data);
  __Pyx_XDECREF((PyObject *)__pyx_v_prev_transition);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_observation);
  __Pyx_XDECREF(__pyx_v_action);
  __Pyx_XDECREF(__pyx_v_reward);
  __Pyx_XDECREF(__pyx_v_next_observation);
  __Pyx_XDECREF((PyObject *)__pyx_v_transition);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":120
 * 
 * 
 * def _check_discrete_action(actions):             # <<<<<<<<<<<<<<
 *     float_actions = np.array(actions, dtype=np.float32)
 *     int_actions = np.array(actions, dtype=np.int32)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_7_check_discrete_action(PyObject *__pyx_self, PyObject *__pyx_v_actions); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_7_check_discrete_action = {"_check_discrete_action", (PyCFunction)__pyx_pw_6minari_7dataset_7_check_discrete_action, METH_O, 0};
static PyObject *__pyx_pw_6minari_7dataset_7_check_discrete_action(PyObject *__pyx_self, PyObject *__pyx_v_actions) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_check_discrete_action (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_6_check_discrete_action(__pyx_self, ((PyObject *)__pyx_v_actions));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_6_check_discrete_action(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_actions) {
  PyObject *__pyx_v_float_actions = NULL;
  PyObject *__pyx_v_int_actions = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__4)
  __Pyx_RefNannySetupContext("_check_discrete_action", 0);
  __Pyx_TraceCall("_check_discrete_action", __pyx_f[0], 120, 0, __PYX_ERR(0, 120, __pyx_L1_error));

  /* "minari/dataset.pyx":121
 * 
 * def _check_discrete_action(actions):
 *     float_actions = np.array(actions, dtype=np.float32)             # <<<<<<<<<<<<<<
 *     int_actions = np.array(actions, dtype=np.int32)
 *     return np.all(float_actions == int_actions)
 */
  __Pyx_TraceLine(121,0,__PYX_ERR(0, 121, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_actions);
  __Pyx_GIVEREF(__pyx_v_actions);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_actions);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_float_actions = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "minari/dataset.pyx":122
 * def _check_discrete_action(actions):
 *     float_actions = np.array(actions, dtype=np.float32)
 *     int_actions = np.array(actions, dtype=np.int32)             # <<<<<<<<<<<<<<
 *     return np.all(float_actions == int_actions)
 * 
 */
  __Pyx_TraceLine(122,0,__PYX_ERR(0, 122, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_actions);
  __Pyx_GIVEREF(__pyx_v_actions);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_actions);
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_int_actions = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "minari/dataset.pyx":123
 *     float_actions = np.array(actions, dtype=np.float32)
 *     int_actions = np.array(actions, dtype=np.int32)
 *     return np.all(float_actions == int_actions)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_TraceLine(123,0,__PYX_ERR(0, 123, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_all); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_float_actions, __pyx_v_int_actions, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":120
 * 
 * 
 * def _check_discrete_action(actions):             # <<<<<<<<<<<<<<
 *     float_actions = np.array(actions, dtype=np.float32)
 *     int_actions = np.array(actions, dtype=np.int32)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("minari.dataset._check_discrete_action", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_float_actions);
  __Pyx_XDECREF(__pyx_v_int_actions);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":185
 * 
 *     """
 *     def __init__(             # <<<<<<<<<<<<<<
 *         self,
 *         dataset_name,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6minari_7dataset_13MinariDataset_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_dataset_name = 0;
  PyObject *__pyx_v_algorithm_name = 0;
  PyObject *__pyx_v_environment_name = 0;
  PyObject *__pyx_v_environment_stack = 0;
  PyObject *__pyx_v_seed_used = 0;
  PyObject *__pyx_v_code_permalink = 0;
  PyObject *__pyx_v_author = 0;
  PyObject *__pyx_v_author_email = 0;
  PyObject *__pyx_v_observations = 0;
  PyObject *__pyx_v_actions = 0;
  PyObject *__pyx_v_rewards = 0;
  PyObject *__pyx_v_terminations = 0;
  PyObject *__pyx_v_truncations = 0;
  PyObject *__pyx_v_episode_terminals = 0;
  PyObject *__pyx_v_discrete_action = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_dataset_name,&__pyx_n_s_algorithm_name,&__pyx_n_s_environment_name,&__pyx_n_s_environment_stack,&__pyx_n_s_seed_used,&__pyx_n_s_code_permalink,&__pyx_n_s_author,&__pyx_n_s_author_email,&__pyx_n_s_observations,&__pyx_n_s_actions,&__pyx_n_s_rewards,&__pyx_n_s_terminations,&__pyx_n_s_truncations,&__pyx_n_s_episode_terminals,&__pyx_n_s_discrete_action,0};
    PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

    /* "minari/dataset.pyx":200
 *         terminations,
 *         truncations,
 *         episode_terminals=None,             # <<<<<<<<<<<<<<
 *         discrete_action=None,
 *     ):
 */
    values[14] = ((PyObject *)((PyObject *)Py_None));

    /* "minari/dataset.pyx":201
 *         truncations,
 *         episode_terminals=None,
 *         discrete_action=None,             # <<<<<<<<<<<<<<
 *     ):
 *         self._dataset_name = dataset_name
 */
    values[15] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataset_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 14, 16, 1); __PYX_ERR(0, 185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_algorithm_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 14, 16, 2); __PYX_ERR(0, 185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_environment_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 14, 16, 3); __PYX_ERR(0, 185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_environment_stack)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 14, 16, 4); __PYX_ERR(0, 185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seed_used)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 14, 16, 5); __PYX_ERR(0, 185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_code_permalink)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 14, 16, 6); __PYX_ERR(0, 185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_author)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 14, 16, 7); __PYX_ERR(0, 185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_author_email)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 14, 16, 8); __PYX_ERR(0, 185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_observations)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 14, 16, 9); __PYX_ERR(0, 185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_actions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 14, 16, 10); __PYX_ERR(0, 185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rewards)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 14, 16, 11); __PYX_ERR(0, 185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_terminations)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 14, 16, 12); __PYX_ERR(0, 185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_truncations)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 14, 16, 13); __PYX_ERR(0, 185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_episode_terminals);
          if (value) { values[14] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_discrete_action);
          if (value) { values[15] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 185, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_dataset_name = values[1];
    __pyx_v_algorithm_name = values[2];
    __pyx_v_environment_name = values[3];
    __pyx_v_environment_stack = values[4];
    __pyx_v_seed_used = values[5];
    __pyx_v_code_permalink = values[6];
    __pyx_v_author = values[7];
    __pyx_v_author_email = values[8];
    __pyx_v_observations = values[9];
    __pyx_v_actions = values[10];
    __pyx_v_rewards = values[11];
    __pyx_v_terminations = values[12];
    __pyx_v_truncations = values[13];
    __pyx_v_episode_terminals = values[14];
    __pyx_v_discrete_action = values[15];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 14, 16, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 185, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("minari.dataset.MinariDataset.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset___init__(__pyx_self, __pyx_v_self, __pyx_v_dataset_name, __pyx_v_algorithm_name, __pyx_v_environment_name, __pyx_v_environment_stack, __pyx_v_seed_used, __pyx_v_code_permalink, __pyx_v_author, __pyx_v_author_email, __pyx_v_observations, __pyx_v_actions, __pyx_v_rewards, __pyx_v_terminations, __pyx_v_truncations, __pyx_v_episode_terminals, __pyx_v_discrete_action);

  /* "minari/dataset.pyx":185
 * 
 *     """
 *     def __init__(             # <<<<<<<<<<<<<<
 *         self,
 *         dataset_name,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_dataset_name, PyObject *__pyx_v_algorithm_name, PyObject *__pyx_v_environment_name, PyObject *__pyx_v_environment_stack, PyObject *__pyx_v_seed_used, PyObject *__pyx_v_code_permalink, PyObject *__pyx_v_author, PyObject *__pyx_v_author_email, PyObject *__pyx_v_observations, PyObject *__pyx_v_actions, PyObject *__pyx_v_rewards, PyObject *__pyx_v_terminations, PyObject *__pyx_v_truncations, PyObject *__pyx_v_episode_terminals, PyObject *__pyx_v_discrete_action) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__5)
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceCall("__init__", __pyx_f[0], 185, 0, __PYX_ERR(0, 185, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_observations);
  __Pyx_INCREF(__pyx_v_discrete_action);

  /* "minari/dataset.pyx":203
 *         discrete_action=None,
 *     ):
 *         self._dataset_name = dataset_name             # <<<<<<<<<<<<<<
 *         self._algorithm_name = algorithm_name
 *         self._environment_name = environment_name
 */
  __Pyx_TraceLine(203,0,__PYX_ERR(0, 203, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dataset_name_2, __pyx_v_dataset_name) < 0) __PYX_ERR(0, 203, __pyx_L1_error)

  /* "minari/dataset.pyx":204
 *     ):
 *         self._dataset_name = dataset_name
 *         self._algorithm_name = algorithm_name             # <<<<<<<<<<<<<<
 *         self._environment_name = environment_name
 *         self._environment_stack = environment_stack
 */
  __Pyx_TraceLine(204,0,__PYX_ERR(0, 204, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_algorithm_name_2, __pyx_v_algorithm_name) < 0) __PYX_ERR(0, 204, __pyx_L1_error)

  /* "minari/dataset.pyx":205
 *         self._dataset_name = dataset_name
 *         self._algorithm_name = algorithm_name
 *         self._environment_name = environment_name             # <<<<<<<<<<<<<<
 *         self._environment_stack = environment_stack
 *         self._seed_used = seed_used
 */
  __Pyx_TraceLine(205,0,__PYX_ERR(0, 205, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_environment_name_2, __pyx_v_environment_name) < 0) __PYX_ERR(0, 205, __pyx_L1_error)

  /* "minari/dataset.pyx":206
 *         self._algorithm_name = algorithm_name
 *         self._environment_name = environment_name
 *         self._environment_stack = environment_stack             # <<<<<<<<<<<<<<
 *         self._seed_used = seed_used
 *         self._code_permalink = code_permalink
 */
  __Pyx_TraceLine(206,0,__PYX_ERR(0, 206, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_environment_stack_2, __pyx_v_environment_stack) < 0) __PYX_ERR(0, 206, __pyx_L1_error)

  /* "minari/dataset.pyx":207
 *         self._environment_name = environment_name
 *         self._environment_stack = environment_stack
 *         self._seed_used = seed_used             # <<<<<<<<<<<<<<
 *         self._code_permalink = code_permalink
 *         self._author = author
 */
  __Pyx_TraceLine(207,0,__PYX_ERR(0, 207, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_seed_used_2, __pyx_v_seed_used) < 0) __PYX_ERR(0, 207, __pyx_L1_error)

  /* "minari/dataset.pyx":208
 *         self._environment_stack = environment_stack
 *         self._seed_used = seed_used
 *         self._code_permalink = code_permalink             # <<<<<<<<<<<<<<
 *         self._author = author
 *         self._author_email = author_email
 */
  __Pyx_TraceLine(208,0,__PYX_ERR(0, 208, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_code_permalink_2, __pyx_v_code_permalink) < 0) __PYX_ERR(0, 208, __pyx_L1_error)

  /* "minari/dataset.pyx":209
 *         self._seed_used = seed_used
 *         self._code_permalink = code_permalink
 *         self._author = author             # <<<<<<<<<<<<<<
 *         self._author_email = author_email
 * 
 */
  __Pyx_TraceLine(209,0,__PYX_ERR(0, 209, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_author_2, __pyx_v_author) < 0) __PYX_ERR(0, 209, __pyx_L1_error)

  /* "minari/dataset.pyx":210
 *         self._code_permalink = code_permalink
 *         self._author = author
 *         self._author_email = author_email             # <<<<<<<<<<<<<<
 * 
 *         # NoneType warnings
 */
  __Pyx_TraceLine(210,0,__PYX_ERR(0, 210, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_author_email_2, __pyx_v_author_email) < 0) __PYX_ERR(0, 210, __pyx_L1_error)

  /* "minari/dataset.pyx":213
 * 
 *         # NoneType warnings
 *         if code_permalink is None:             # <<<<<<<<<<<<<<
 *             warnings.warn("`code_permalink` is set to None. For reproducibility purposes it is highly recommended to link your dataset to versioned code.", UserWarning)
 *         if author is None:
 */
  __Pyx_TraceLine(213,0,__PYX_ERR(0, 213, __pyx_L1_error))
  __pyx_t_1 = (__pyx_v_code_permalink == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "minari/dataset.pyx":214
 *         # NoneType warnings
 *         if code_permalink is None:
 *             warnings.warn("`code_permalink` is set to None. For reproducibility purposes it is highly recommended to link your dataset to versioned code.", UserWarning)             # <<<<<<<<<<<<<<
 *         if author is None:
 *             warnings.warn("`author` is set to None. For longevity purposes it is highly recommended to provide an author name.", UserWarning)
 */
    __Pyx_TraceLine(214,0,__PYX_ERR(0, 214, __pyx_L1_error))
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_warnings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "minari/dataset.pyx":213
 * 
 *         # NoneType warnings
 *         if code_permalink is None:             # <<<<<<<<<<<<<<
 *             warnings.warn("`code_permalink` is set to None. For reproducibility purposes it is highly recommended to link your dataset to versioned code.", UserWarning)
 *         if author is None:
 */
  }

  /* "minari/dataset.pyx":215
 *         if code_permalink is None:
 *             warnings.warn("`code_permalink` is set to None. For reproducibility purposes it is highly recommended to link your dataset to versioned code.", UserWarning)
 *         if author is None:             # <<<<<<<<<<<<<<
 *             warnings.warn("`author` is set to None. For longevity purposes it is highly recommended to provide an author name.", UserWarning)
 *         if author_email is None:
 */
  __Pyx_TraceLine(215,0,__PYX_ERR(0, 215, __pyx_L1_error))
  __pyx_t_2 = (__pyx_v_author == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "minari/dataset.pyx":216
 *             warnings.warn("`code_permalink` is set to None. For reproducibility purposes it is highly recommended to link your dataset to versioned code.", UserWarning)
 *         if author is None:
 *             warnings.warn("`author` is set to None. For longevity purposes it is highly recommended to provide an author name.", UserWarning)             # <<<<<<<<<<<<<<
 *         if author_email is None:
 *             warnings.warn("`author_email` is set to None. For longevity purposes it is highly recommended to provide an author email, or some other obvious contact information.", UserWarning)
 */
    __Pyx_TraceLine(216,0,__PYX_ERR(0, 216, __pyx_L1_error))
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_warnings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "minari/dataset.pyx":215
 *         if code_permalink is None:
 *             warnings.warn("`code_permalink` is set to None. For reproducibility purposes it is highly recommended to link your dataset to versioned code.", UserWarning)
 *         if author is None:             # <<<<<<<<<<<<<<
 *             warnings.warn("`author` is set to None. For longevity purposes it is highly recommended to provide an author name.", UserWarning)
 *         if author_email is None:
 */
  }

  /* "minari/dataset.pyx":217
 *         if author is None:
 *             warnings.warn("`author` is set to None. For longevity purposes it is highly recommended to provide an author name.", UserWarning)
 *         if author_email is None:             # <<<<<<<<<<<<<<
 *             warnings.warn("`author_email` is set to None. For longevity purposes it is highly recommended to provide an author email, or some other obvious contact information.", UserWarning)
 *         if environment_stack is None:
 */
  __Pyx_TraceLine(217,0,__PYX_ERR(0, 217, __pyx_L1_error))
  __pyx_t_1 = (__pyx_v_author_email == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "minari/dataset.pyx":218
 *             warnings.warn("`author` is set to None. For longevity purposes it is highly recommended to provide an author name.", UserWarning)
 *         if author_email is None:
 *             warnings.warn("`author_email` is set to None. For longevity purposes it is highly recommended to provide an author email, or some other obvious contact information.", UserWarning)             # <<<<<<<<<<<<<<
 *         if environment_stack is None:
 *             warnings.warn("`environment_stack` is set to None. For reproducibility purposes it is highly recommended to provide the environment stack.", UserWarning)
 */
    __Pyx_TraceLine(218,0,__PYX_ERR(0, 218, __pyx_L1_error))
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_warnings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "minari/dataset.pyx":217
 *         if author is None:
 *             warnings.warn("`author` is set to None. For longevity purposes it is highly recommended to provide an author name.", UserWarning)
 *         if author_email is None:             # <<<<<<<<<<<<<<
 *             warnings.warn("`author_email` is set to None. For longevity purposes it is highly recommended to provide an author email, or some other obvious contact information.", UserWarning)
 *         if environment_stack is None:
 */
  }

  /* "minari/dataset.pyx":219
 *         if author_email is None:
 *             warnings.warn("`author_email` is set to None. For longevity purposes it is highly recommended to provide an author email, or some other obvious contact information.", UserWarning)
 *         if environment_stack is None:             # <<<<<<<<<<<<<<
 *             warnings.warn("`environment_stack` is set to None. For reproducibility purposes it is highly recommended to provide the environment stack.", UserWarning)
 * 
 */
  __Pyx_TraceLine(219,0,__PYX_ERR(0, 219, __pyx_L1_error))
  __pyx_t_2 = (__pyx_v_environment_stack == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "minari/dataset.pyx":220
 *             warnings.warn("`author_email` is set to None. For longevity purposes it is highly recommended to provide an author email, or some other obvious contact information.", UserWarning)
 *         if environment_stack is None:
 *             warnings.warn("`environment_stack` is set to None. For reproducibility purposes it is highly recommended to provide the environment stack.", UserWarning)             # <<<<<<<<<<<<<<
 * 
 *         # validation
 */
    __Pyx_TraceLine(220,0,__PYX_ERR(0, 220, __pyx_L1_error))
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_warnings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "minari/dataset.pyx":219
 *         if author_email is None:
 *             warnings.warn("`author_email` is set to None. For longevity purposes it is highly recommended to provide an author email, or some other obvious contact information.", UserWarning)
 *         if environment_stack is None:             # <<<<<<<<<<<<<<
 *             warnings.warn("`environment_stack` is set to None. For reproducibility purposes it is highly recommended to provide the environment stack.", UserWarning)
 * 
 */
  }

  /* "minari/dataset.pyx":223
 * 
 *         # validation
 *         assert isinstance(observations, np.ndarray),\             # <<<<<<<<<<<<<<
 *             'Observations must be numpy array.'
 *         if len(observations.shape) == 4:
 */
  __Pyx_TraceLine(223,0,__PYX_ERR(0, 223, __pyx_L1_error))
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_observations, __pyx_ptype_5numpy_ndarray); 
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Observations_must_be_numpy_array);
      __PYX_ERR(0, 223, __pyx_L1_error)
    }
  }
  #endif

  /* "minari/dataset.pyx":225
 *         assert isinstance(observations, np.ndarray),\
 *             'Observations must be numpy array.'
 *         if len(observations.shape) == 4:             # <<<<<<<<<<<<<<
 *             assert observations.dtype == np.uint8,\
 *                 'Image observation must be uint8 array.'
 */
  __Pyx_TraceLine(225,0,__PYX_ERR(0, 225, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_observations, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 225, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = ((__pyx_t_5 == 4) != 0);
  if (__pyx_t_1) {

    /* "minari/dataset.pyx":226
 *             'Observations must be numpy array.'
 *         if len(observations.shape) == 4:
 *             assert observations.dtype == np.uint8,\             # <<<<<<<<<<<<<<
 *                 'Image observation must be uint8 array.'
 *         else:
 */
    __Pyx_TraceLine(226,0,__PYX_ERR(0, 226, __pyx_L1_error))
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_observations, __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 226, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 226, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Image_observation_must_be_uint8);
        __PYX_ERR(0, 226, __pyx_L1_error)
      }
    }
    #endif

    /* "minari/dataset.pyx":225
 *         assert isinstance(observations, np.ndarray),\
 *             'Observations must be numpy array.'
 *         if len(observations.shape) == 4:             # <<<<<<<<<<<<<<
 *             assert observations.dtype == np.uint8,\
 *                 'Image observation must be uint8 array.'
 */
    goto __pyx_L7;
  }

  /* "minari/dataset.pyx":229
 *                 'Image observation must be uint8 array.'
 *         else:
 *             if observations.dtype != np.float32:             # <<<<<<<<<<<<<<
 *                 observations = np.asarray(observations, dtype=np.float32)
 * 
 */
  __Pyx_TraceLine(229,0,__PYX_ERR(0, 229, __pyx_L1_error))
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_observations, __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 229, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 229, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 229, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 229, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 229, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_1) {

      /* "minari/dataset.pyx":230
 *         else:
 *             if observations.dtype != np.float32:
 *                 observations = np.asarray(observations, dtype=np.float32)             # <<<<<<<<<<<<<<
 * 
 *         # check nan
 */
      __Pyx_TraceLine(230,0,__PYX_ERR(0, 230, __pyx_L1_error))
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_observations);
      __Pyx_GIVEREF(__pyx_v_observations);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_observations);
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float32); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_observations, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "minari/dataset.pyx":229
 *                 'Image observation must be uint8 array.'
 *         else:
 *             if observations.dtype != np.float32:             # <<<<<<<<<<<<<<
 *                 observations = np.asarray(observations, dtype=np.float32)
 * 
 */
    }
  }
  __pyx_L7:;

  /* "minari/dataset.pyx":233
 * 
 *         # check nan
 *         assert np.all(np.logical_not(np.isnan(observations)))             # <<<<<<<<<<<<<<
 *         assert np.all(np.logical_not(np.isnan(actions)))
 *         assert np.all(np.logical_not(np.isnan(rewards)))
 */
  __Pyx_TraceLine(233,0,__PYX_ERR(0, 233, __pyx_L1_error))
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_all); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_logical_not); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_isnan); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_v_observations) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_observations);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_10, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_8 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 233, __pyx_L1_error)
    }
  }
  #endif

  /* "minari/dataset.pyx":234
 *         # check nan
 *         assert np.all(np.logical_not(np.isnan(observations)))
 *         assert np.all(np.logical_not(np.isnan(actions)))             # <<<<<<<<<<<<<<
 *         assert np.all(np.logical_not(np.isnan(rewards)))
 *         assert np.all(np.logical_not(np.isnan(terminations)))
 */
  __Pyx_TraceLine(234,0,__PYX_ERR(0, 234, __pyx_L1_error))
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_all); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_logical_not); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_isnan); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_v_actions) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_actions);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_8 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 234, __pyx_L1_error)
    }
  }
  #endif

  /* "minari/dataset.pyx":235
 *         assert np.all(np.logical_not(np.isnan(observations)))
 *         assert np.all(np.logical_not(np.isnan(actions)))
 *         assert np.all(np.logical_not(np.isnan(rewards)))             # <<<<<<<<<<<<<<
 *         assert np.all(np.logical_not(np.isnan(terminations)))
 *         assert np.all(np.logical_not(np.isnan(truncations)))
 */
  __Pyx_TraceLine(235,0,__PYX_ERR(0, 235, __pyx_L1_error))
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_all); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_logical_not); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_isnan); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_v_rewards) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_rewards);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_10, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_8 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 235, __pyx_L1_error)
    }
  }
  #endif

  /* "minari/dataset.pyx":236
 *         assert np.all(np.logical_not(np.isnan(actions)))
 *         assert np.all(np.logical_not(np.isnan(rewards)))
 *         assert np.all(np.logical_not(np.isnan(terminations)))             # <<<<<<<<<<<<<<
 *         assert np.all(np.logical_not(np.isnan(truncations)))
 * 
 */
  __Pyx_TraceLine(236,0,__PYX_ERR(0, 236, __pyx_L1_error))
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_all); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_logical_not); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_isnan); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_v_terminations) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_terminations);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_8 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 236, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 236, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 236, __pyx_L1_error)
    }
  }
  #endif

  /* "minari/dataset.pyx":237
 *         assert np.all(np.logical_not(np.isnan(rewards)))
 *         assert np.all(np.logical_not(np.isnan(terminations)))
 *         assert np.all(np.logical_not(np.isnan(truncations)))             # <<<<<<<<<<<<<<
 * 
 *         self._observations = observations
 */
  __Pyx_TraceLine(237,0,__PYX_ERR(0, 237, __pyx_L1_error))
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_all); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_logical_not); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_isnan); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_v_truncations) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_truncations);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_10, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_8 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 237, __pyx_L1_error)
    }
  }
  #endif

  /* "minari/dataset.pyx":239
 *         assert np.all(np.logical_not(np.isnan(truncations)))
 * 
 *         self._observations = observations             # <<<<<<<<<<<<<<
 *         self._rewards = np.asarray(rewards, dtype=np.float32).reshape(-1)
 *         self._terminations = np.asarray(terminations, dtype=np.float32).reshape(-1)
 */
  __Pyx_TraceLine(239,0,__PYX_ERR(0, 239, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_observations_2, __pyx_v_observations) < 0) __PYX_ERR(0, 239, __pyx_L1_error)

  /* "minari/dataset.pyx":240
 * 
 *         self._observations = observations
 *         self._rewards = np.asarray(rewards, dtype=np.float32).reshape(-1)             # <<<<<<<<<<<<<<
 *         self._terminations = np.asarray(terminations, dtype=np.float32).reshape(-1)
 *         self._truncations = np.asarray(truncations, dtype=np.float32).reshape(-1)
 */
  __Pyx_TraceLine(240,0,__PYX_ERR(0, 240, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_rewards);
  __Pyx_GIVEREF(__pyx_v_rewards);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_rewards);
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_reshape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_10, __pyx_int_neg_1) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_int_neg_1);
  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_rewards_2, __pyx_t_8) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "minari/dataset.pyx":241
 *         self._observations = observations
 *         self._rewards = np.asarray(rewards, dtype=np.float32).reshape(-1)
 *         self._terminations = np.asarray(terminations, dtype=np.float32).reshape(-1)             # <<<<<<<<<<<<<<
 *         self._truncations = np.asarray(truncations, dtype=np.float32).reshape(-1)
 * 
 */
  __Pyx_TraceLine(241,0,__PYX_ERR(0, 241, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_asarray); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v_terminations);
  __Pyx_GIVEREF(__pyx_v_terminations);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_terminations);
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_reshape); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_8 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_int_neg_1) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_int_neg_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_terminations_2, __pyx_t_8) < 0) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "minari/dataset.pyx":242
 *         self._rewards = np.asarray(rewards, dtype=np.float32).reshape(-1)
 *         self._terminations = np.asarray(terminations, dtype=np.float32).reshape(-1)
 *         self._truncations = np.asarray(truncations, dtype=np.float32).reshape(-1)             # <<<<<<<<<<<<<<
 * 
 *         if episode_terminals is None:
 */
  __Pyx_TraceLine(242,0,__PYX_ERR(0, 242, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_truncations);
  __Pyx_GIVEREF(__pyx_v_truncations);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_truncations);
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_reshape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_8 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_4, __pyx_int_neg_1) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_int_neg_1);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_truncations_2, __pyx_t_8) < 0) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "minari/dataset.pyx":244
 *         self._truncations = np.asarray(truncations, dtype=np.float32).reshape(-1)
 * 
 *         if episode_terminals is None:             # <<<<<<<<<<<<<<
 *             # if None, episode terminals match the environment terminals
 *             self._episode_terminals = self._terminations
 */
  __Pyx_TraceLine(244,0,__PYX_ERR(0, 244, __pyx_L1_error))
  __pyx_t_1 = (__pyx_v_episode_terminals == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "minari/dataset.pyx":246
 *         if episode_terminals is None:
 *             # if None, episode terminals match the environment terminals
 *             self._episode_terminals = self._terminations             # <<<<<<<<<<<<<<
 *         else:
 *             self._episode_terminals = np.asarray(
 */
    __Pyx_TraceLine(246,0,__PYX_ERR(0, 246, __pyx_L1_error))
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_terminations_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_episode_terminals_2, __pyx_t_8) < 0) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "minari/dataset.pyx":244
 *         self._truncations = np.asarray(truncations, dtype=np.float32).reshape(-1)
 * 
 *         if episode_terminals is None:             # <<<<<<<<<<<<<<
 *             # if None, episode terminals match the environment terminals
 *             self._episode_terminals = self._terminations
 */
    goto __pyx_L9;
  }

  /* "minari/dataset.pyx":249
 *         else:
 *             self._episode_terminals = np.asarray(
 *                 episode_terminals, dtype=np.float32).reshape(-1)             # <<<<<<<<<<<<<<
 * 
 *         # automatic action type detection
 */
  __Pyx_TraceLine(249,0,__PYX_ERR(0, 249, __pyx_L1_error))
  /*else*/ {

    /* "minari/dataset.pyx":248
 *             self._episode_terminals = self._terminations
 *         else:
 *             self._episode_terminals = np.asarray(             # <<<<<<<<<<<<<<
 *                 episode_terminals, dtype=np.float32).reshape(-1)
 * 
 */
    __Pyx_TraceLine(248,0,__PYX_ERR(0, 248, __pyx_L1_error))
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "minari/dataset.pyx":249
 *         else:
 *             self._episode_terminals = np.asarray(
 *                 episode_terminals, dtype=np.float32).reshape(-1)             # <<<<<<<<<<<<<<
 * 
 *         # automatic action type detection
 */
    __Pyx_TraceLine(249,0,__PYX_ERR(0, 249, __pyx_L1_error))
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_episode_terminals);
    __Pyx_GIVEREF(__pyx_v_episode_terminals);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_episode_terminals);
    __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "minari/dataset.pyx":248
 *             self._episode_terminals = self._terminations
 *         else:
 *             self._episode_terminals = np.asarray(             # <<<<<<<<<<<<<<
 *                 episode_terminals, dtype=np.float32).reshape(-1)
 * 
 */
    __Pyx_TraceLine(248,0,__PYX_ERR(0, 248, __pyx_L1_error))
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "minari/dataset.pyx":249
 *         else:
 *             self._episode_terminals = np.asarray(
 *                 episode_terminals, dtype=np.float32).reshape(-1)             # <<<<<<<<<<<<<<
 * 
 *         # automatic action type detection
 */
    __Pyx_TraceLine(249,0,__PYX_ERR(0, 249, __pyx_L1_error))
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_reshape); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_10, __pyx_int_neg_1) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_int_neg_1);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "minari/dataset.pyx":248
 *             self._episode_terminals = self._terminations
 *         else:
 *             self._episode_terminals = np.asarray(             # <<<<<<<<<<<<<<
 *                 episode_terminals, dtype=np.float32).reshape(-1)
 * 
 */
    __Pyx_TraceLine(248,0,__PYX_ERR(0, 248, __pyx_L1_error))
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_episode_terminals_2, __pyx_t_8) < 0) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __pyx_L9:;

  /* "minari/dataset.pyx":252
 * 
 *         # automatic action type detection
 *         if discrete_action is None:             # <<<<<<<<<<<<<<
 *             discrete_action = _check_discrete_action(actions)
 * 
 */
  __Pyx_TraceLine(252,0,__PYX_ERR(0, 252, __pyx_L1_error))
  __pyx_t_2 = (__pyx_v_discrete_action == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "minari/dataset.pyx":253
 *         # automatic action type detection
 *         if discrete_action is None:
 *             discrete_action = _check_discrete_action(actions)             # <<<<<<<<<<<<<<
 * 
 *         self.discrete_action = discrete_action
 */
    __Pyx_TraceLine(253,0,__PYX_ERR(0, 253, __pyx_L1_error))
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_check_discrete_action); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_10, __pyx_v_actions) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_actions);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_discrete_action, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "minari/dataset.pyx":252
 * 
 *         # automatic action type detection
 *         if discrete_action is None:             # <<<<<<<<<<<<<<
 *             discrete_action = _check_discrete_action(actions)
 * 
 */
  }

  /* "minari/dataset.pyx":255
 *             discrete_action = _check_discrete_action(actions)
 * 
 *         self.discrete_action = discrete_action             # <<<<<<<<<<<<<<
 *         if discrete_action:
 *             self._actions = np.asarray(actions, dtype=np.int32).reshape(-1)
 */
  __Pyx_TraceLine(255,0,__PYX_ERR(0, 255, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_discrete_action, __pyx_v_discrete_action) < 0) __PYX_ERR(0, 255, __pyx_L1_error)

  /* "minari/dataset.pyx":256
 * 
 *         self.discrete_action = discrete_action
 *         if discrete_action:             # <<<<<<<<<<<<<<
 *             self._actions = np.asarray(actions, dtype=np.int32).reshape(-1)
 *         else:
 */
  __Pyx_TraceLine(256,0,__PYX_ERR(0, 256, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_discrete_action); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 256, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "minari/dataset.pyx":257
 *         self.discrete_action = discrete_action
 *         if discrete_action:
 *             self._actions = np.asarray(actions, dtype=np.int32).reshape(-1)             # <<<<<<<<<<<<<<
 *         else:
 *             self._actions = np.asarray(actions, dtype=np.float32)
 */
    __Pyx_TraceLine(257,0,__PYX_ERR(0, 257, __pyx_L1_error))
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_asarray); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_actions);
    __Pyx_GIVEREF(__pyx_v_actions);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_actions);
    __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_reshape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_8 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_3, __pyx_int_neg_1) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_int_neg_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_actions_2, __pyx_t_8) < 0) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "minari/dataset.pyx":256
 * 
 *         self.discrete_action = discrete_action
 *         if discrete_action:             # <<<<<<<<<<<<<<
 *             self._actions = np.asarray(actions, dtype=np.int32).reshape(-1)
 *         else:
 */
    goto __pyx_L11;
  }

  /* "minari/dataset.pyx":259
 *             self._actions = np.asarray(actions, dtype=np.int32).reshape(-1)
 *         else:
 *             self._actions = np.asarray(actions, dtype=np.float32)             # <<<<<<<<<<<<<<
 * 
 *         self._episodes = None
 */
  __Pyx_TraceLine(259,0,__PYX_ERR(0, 259, __pyx_L1_error))
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_asarray); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_actions);
    __Pyx_GIVEREF(__pyx_v_actions);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_actions);
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float32); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_actions_2, __pyx_t_10) < 0) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __pyx_L11:;

  /* "minari/dataset.pyx":261
 *             self._actions = np.asarray(actions, dtype=np.float32)
 * 
 *         self._episodes = None             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(261,0,__PYX_ERR(0, 261, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_episodes, Py_None) < 0) __PYX_ERR(0, 261, __pyx_L1_error)

  /* "minari/dataset.pyx":185
 * 
 *     """
 *     def __init__(             # <<<<<<<<<<<<<<
 *         self,
 *         dataset_name,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_observations);
  __Pyx_XDECREF(__pyx_v_discrete_action);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":264
 * 
 *     @property
 *     def dataset_name(self):             # <<<<<<<<<<<<<<
 *         return self._dataset_name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_3dataset_name(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_3dataset_name = {"dataset_name", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_3dataset_name, METH_O, 0};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_3dataset_name(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dataset_name (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_2dataset_name(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_2dataset_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__10)
  __Pyx_RefNannySetupContext("dataset_name", 0);
  __Pyx_TraceCall("dataset_name", __pyx_f[0], 264, 0, __PYX_ERR(0, 264, __pyx_L1_error));

  /* "minari/dataset.pyx":265
 *     @property
 *     def dataset_name(self):
 *         return self._dataset_name             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(265,0,__PYX_ERR(0, 265, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dataset_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":264
 * 
 *     @property
 *     def dataset_name(self):             # <<<<<<<<<<<<<<
 *         return self._dataset_name
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.dataset_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":268
 * 
 *     @property
 *     def algorithm_name(self):             # <<<<<<<<<<<<<<
 *         return self._algorithm_name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_5algorithm_name(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_5algorithm_name = {"algorithm_name", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_5algorithm_name, METH_O, 0};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_5algorithm_name(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algorithm_name (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_4algorithm_name(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_4algorithm_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__11)
  __Pyx_RefNannySetupContext("algorithm_name", 0);
  __Pyx_TraceCall("algorithm_name", __pyx_f[0], 268, 0, __PYX_ERR(0, 268, __pyx_L1_error));

  /* "minari/dataset.pyx":269
 *     @property
 *     def algorithm_name(self):
 *         return self._algorithm_name             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(269,0,__PYX_ERR(0, 269, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_algorithm_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":268
 * 
 *     @property
 *     def algorithm_name(self):             # <<<<<<<<<<<<<<
 *         return self._algorithm_name
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.algorithm_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":272
 * 
 *     @property
 *     def environment_name(self):             # <<<<<<<<<<<<<<
 *         return self._environment_name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_7environment_name(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_7environment_name = {"environment_name", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_7environment_name, METH_O, 0};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_7environment_name(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("environment_name (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_6environment_name(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_6environment_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__12)
  __Pyx_RefNannySetupContext("environment_name", 0);
  __Pyx_TraceCall("environment_name", __pyx_f[0], 272, 0, __PYX_ERR(0, 272, __pyx_L1_error));

  /* "minari/dataset.pyx":273
 *     @property
 *     def environment_name(self):
 *         return self._environment_name             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(273,0,__PYX_ERR(0, 273, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_environment_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":272
 * 
 *     @property
 *     def environment_name(self):             # <<<<<<<<<<<<<<
 *         return self._environment_name
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.environment_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":276
 * 
 *     @property
 *     def environment_stack(self):             # <<<<<<<<<<<<<<
 *         return self._environment_stack
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_9environment_stack(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_9environment_stack = {"environment_stack", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_9environment_stack, METH_O, 0};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_9environment_stack(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("environment_stack (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_8environment_stack(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_8environment_stack(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__13)
  __Pyx_RefNannySetupContext("environment_stack", 0);
  __Pyx_TraceCall("environment_stack", __pyx_f[0], 276, 0, __PYX_ERR(0, 276, __pyx_L1_error));

  /* "minari/dataset.pyx":277
 *     @property
 *     def environment_stack(self):
 *         return self._environment_stack             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(277,0,__PYX_ERR(0, 277, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_environment_stack_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":276
 * 
 *     @property
 *     def environment_stack(self):             # <<<<<<<<<<<<<<
 *         return self._environment_stack
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.environment_stack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":280
 * 
 *     @property
 *     def seed_used(self):             # <<<<<<<<<<<<<<
 *         return self._seed_used
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_11seed_used(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_11seed_used = {"seed_used", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_11seed_used, METH_O, 0};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_11seed_used(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("seed_used (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_10seed_used(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_10seed_used(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__14)
  __Pyx_RefNannySetupContext("seed_used", 0);
  __Pyx_TraceCall("seed_used", __pyx_f[0], 280, 0, __PYX_ERR(0, 280, __pyx_L1_error));

  /* "minari/dataset.pyx":281
 *     @property
 *     def seed_used(self):
 *         return self._seed_used             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(281,0,__PYX_ERR(0, 281, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_seed_used_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":280
 * 
 *     @property
 *     def seed_used(self):             # <<<<<<<<<<<<<<
 *         return self._seed_used
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.seed_used", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":284
 * 
 *     @property
 *     def code_permalink(self):             # <<<<<<<<<<<<<<
 *         return self._code_permalink
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_13code_permalink(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_13code_permalink = {"code_permalink", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_13code_permalink, METH_O, 0};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_13code_permalink(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("code_permalink (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_12code_permalink(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_12code_permalink(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__15)
  __Pyx_RefNannySetupContext("code_permalink", 0);
  __Pyx_TraceCall("code_permalink", __pyx_f[0], 284, 0, __PYX_ERR(0, 284, __pyx_L1_error));

  /* "minari/dataset.pyx":285
 *     @property
 *     def code_permalink(self):
 *         return self._code_permalink             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(285,0,__PYX_ERR(0, 285, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_code_permalink_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":284
 * 
 *     @property
 *     def code_permalink(self):             # <<<<<<<<<<<<<<
 *         return self._code_permalink
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.code_permalink", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":288
 * 
 *     @property
 *     def author(self):             # <<<<<<<<<<<<<<
 *         return self._author
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_15author(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_15author = {"author", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_15author, METH_O, 0};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_15author(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("author (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_14author(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_14author(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__16)
  __Pyx_RefNannySetupContext("author", 0);
  __Pyx_TraceCall("author", __pyx_f[0], 288, 0, __PYX_ERR(0, 288, __pyx_L1_error));

  /* "minari/dataset.pyx":289
 *     @property
 *     def author(self):
 *         return self._author             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(289,0,__PYX_ERR(0, 289, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_author_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":288
 * 
 *     @property
 *     def author(self):             # <<<<<<<<<<<<<<
 *         return self._author
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.author", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":292
 * 
 *     @property
 *     def author_email(self):             # <<<<<<<<<<<<<<
 *         return self._author_email
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_17author_email(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_17author_email = {"author_email", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_17author_email, METH_O, 0};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_17author_email(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("author_email (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_16author_email(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_16author_email(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__17)
  __Pyx_RefNannySetupContext("author_email", 0);
  __Pyx_TraceCall("author_email", __pyx_f[0], 292, 0, __PYX_ERR(0, 292, __pyx_L1_error));

  /* "minari/dataset.pyx":293
 *     @property
 *     def author_email(self):
 *         return self._author_email             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(293,0,__PYX_ERR(0, 293, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_author_email_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":292
 * 
 *     @property
 *     def author_email(self):             # <<<<<<<<<<<<<<
 *         return self._author_email
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.author_email", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":296
 * 
 *     @property
 *     def observations(self):             # <<<<<<<<<<<<<<
 *         """ Returns the observations.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_19observations(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_18observations[] = " Returns the observations.\n\n        Returns:\n            numpy.ndarray: array of observations.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_19observations = {"observations", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_19observations, METH_O, __pyx_doc_6minari_7dataset_13MinariDataset_18observations};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_19observations(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("observations (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_18observations(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_18observations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__18)
  __Pyx_RefNannySetupContext("observations", 0);
  __Pyx_TraceCall("observations", __pyx_f[0], 296, 0, __PYX_ERR(0, 296, __pyx_L1_error));

  /* "minari/dataset.pyx":303
 * 
 *         """
 *         return self._observations             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(303,0,__PYX_ERR(0, 303, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_observations_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":296
 * 
 *     @property
 *     def observations(self):             # <<<<<<<<<<<<<<
 *         """ Returns the observations.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.observations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":306
 * 
 *     @property
 *     def actions(self):             # <<<<<<<<<<<<<<
 *         """ Returns the actions.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_21actions(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_20actions[] = " Returns the actions.\n\n        Returns:\n            numpy.ndarray: array of actions.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_21actions = {"actions", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_21actions, METH_O, __pyx_doc_6minari_7dataset_13MinariDataset_20actions};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_21actions(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("actions (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_20actions(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_20actions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__19)
  __Pyx_RefNannySetupContext("actions", 0);
  __Pyx_TraceCall("actions", __pyx_f[0], 306, 0, __PYX_ERR(0, 306, __pyx_L1_error));

  /* "minari/dataset.pyx":313
 * 
 *         """
 *         return self._actions             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(313,0,__PYX_ERR(0, 313, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_actions_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":306
 * 
 *     @property
 *     def actions(self):             # <<<<<<<<<<<<<<
 *         """ Returns the actions.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.actions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":316
 * 
 *     @property
 *     def rewards(self):             # <<<<<<<<<<<<<<
 *         """ Returns the rewards.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_23rewards(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_22rewards[] = " Returns the rewards.\n\n        Returns:\n            numpy.ndarray: array of rewards\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_23rewards = {"rewards", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_23rewards, METH_O, __pyx_doc_6minari_7dataset_13MinariDataset_22rewards};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_23rewards(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rewards (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_22rewards(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_22rewards(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__20)
  __Pyx_RefNannySetupContext("rewards", 0);
  __Pyx_TraceCall("rewards", __pyx_f[0], 316, 0, __PYX_ERR(0, 316, __pyx_L1_error));

  /* "minari/dataset.pyx":323
 * 
 *         """
 *         return self._rewards             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(323,0,__PYX_ERR(0, 323, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rewards_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":316
 * 
 *     @property
 *     def rewards(self):             # <<<<<<<<<<<<<<
 *         """ Returns the rewards.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.rewards", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":326
 * 
 *     @property
 *     def terminations(self):             # <<<<<<<<<<<<<<
 *         """ Returns the terminations flags.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_25terminations(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_24terminations[] = " Returns the terminations flags.\n\n        Returns:\n            numpy.ndarray: array of terminal flags.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_25terminations = {"terminations", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_25terminations, METH_O, __pyx_doc_6minari_7dataset_13MinariDataset_24terminations};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_25terminations(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("terminations (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_24terminations(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_24terminations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__21)
  __Pyx_RefNannySetupContext("terminations", 0);
  __Pyx_TraceCall("terminations", __pyx_f[0], 326, 0, __PYX_ERR(0, 326, __pyx_L1_error));

  /* "minari/dataset.pyx":333
 * 
 *         """
 *         return self._terminations             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(333,0,__PYX_ERR(0, 333, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_terminations_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":326
 * 
 *     @property
 *     def terminations(self):             # <<<<<<<<<<<<<<
 *         """ Returns the terminations flags.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.terminations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":336
 * 
 *     @property
 *     def truncations(self):             # <<<<<<<<<<<<<<
 *         """ Returns the terminations flags.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_27truncations(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_26truncations[] = " Returns the terminations flags.\n\n        Returns:\n            numpy.ndarray: array of terminal flags.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_27truncations = {"truncations", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_27truncations, METH_O, __pyx_doc_6minari_7dataset_13MinariDataset_26truncations};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_27truncations(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("truncations (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_26truncations(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_26truncations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__22)
  __Pyx_RefNannySetupContext("truncations", 0);
  __Pyx_TraceCall("truncations", __pyx_f[0], 336, 0, __PYX_ERR(0, 336, __pyx_L1_error));

  /* "minari/dataset.pyx":343
 * 
 *         """
 *         return self._truncations             # <<<<<<<<<<<<<<
 *     @property
 *     def episode_terminals(self):
 */
  __Pyx_TraceLine(343,0,__PYX_ERR(0, 343, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_truncations_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":336
 * 
 *     @property
 *     def truncations(self):             # <<<<<<<<<<<<<<
 *         """ Returns the terminations flags.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.truncations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":345
 *         return self._truncations
 *     @property
 *     def episode_terminals(self):             # <<<<<<<<<<<<<<
 *         """ Returns the episode terminal flags.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_29episode_terminals(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_28episode_terminals[] = " Returns the episode terminal flags.\n\n        Returns:\n            numpy.ndarray: array of episode terminal flags.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_29episode_terminals = {"episode_terminals", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_29episode_terminals, METH_O, __pyx_doc_6minari_7dataset_13MinariDataset_28episode_terminals};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_29episode_terminals(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("episode_terminals (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_28episode_terminals(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_28episode_terminals(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__23)
  __Pyx_RefNannySetupContext("episode_terminals", 0);
  __Pyx_TraceCall("episode_terminals", __pyx_f[0], 345, 0, __PYX_ERR(0, 345, __pyx_L1_error));

  /* "minari/dataset.pyx":352
 * 
 *         """
 *         return self._episode_terminals             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(352,0,__PYX_ERR(0, 352, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_episode_terminals_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":345
 *         return self._truncations
 *     @property
 *     def episode_terminals(self):             # <<<<<<<<<<<<<<
 *         """ Returns the episode terminal flags.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.episode_terminals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":355
 * 
 *     @property
 *     def episodes(self):             # <<<<<<<<<<<<<<
 *         """ Returns the episodes.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_31episodes(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_30episodes[] = " Returns the episodes.\n\n        Returns:\n            list(minari.dataset.Episode):\n                list of :class:`minari.dataset.Episode` objects.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_31episodes = {"episodes", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_31episodes, METH_O, __pyx_doc_6minari_7dataset_13MinariDataset_30episodes};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_31episodes(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("episodes (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_30episodes(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_30episodes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__24)
  __Pyx_RefNannySetupContext("episodes", 0);
  __Pyx_TraceCall("episodes", __pyx_f[0], 355, 0, __PYX_ERR(0, 355, __pyx_L1_error));

  /* "minari/dataset.pyx":363
 * 
 *         """
 *         if self._episodes is None:             # <<<<<<<<<<<<<<
 *             self.build_episodes()
 *         return self._episodes
 */
  __Pyx_TraceLine(363,0,__PYX_ERR(0, 363, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_episodes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "minari/dataset.pyx":364
 *         """
 *         if self._episodes is None:
 *             self.build_episodes()             # <<<<<<<<<<<<<<
 *         return self._episodes
 * 
 */
    __Pyx_TraceLine(364,0,__PYX_ERR(0, 364, __pyx_L1_error))
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_build_episodes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "minari/dataset.pyx":363
 * 
 *         """
 *         if self._episodes is None:             # <<<<<<<<<<<<<<
 *             self.build_episodes()
 *         return self._episodes
 */
  }

  /* "minari/dataset.pyx":365
 *         if self._episodes is None:
 *             self.build_episodes()
 *         return self._episodes             # <<<<<<<<<<<<<<
 * 
 *     def size(self):
 */
  __Pyx_TraceLine(365,0,__PYX_ERR(0, 365, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_episodes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":355
 * 
 *     @property
 *     def episodes(self):             # <<<<<<<<<<<<<<
 *         """ Returns the episodes.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.episodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":367
 *         return self._episodes
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         """ Returns the number of episodes in the dataset.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_33size(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_32size[] = " Returns the number of episodes in the dataset.\n\n        Returns:\n            int: the number of episodes.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_33size = {"size", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_33size, METH_O, __pyx_doc_6minari_7dataset_13MinariDataset_32size};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_33size(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("size (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_32size(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_32size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__25)
  __Pyx_RefNannySetupContext("size", 0);
  __Pyx_TraceCall("size", __pyx_f[0], 367, 0, __PYX_ERR(0, 367, __pyx_L1_error));

  /* "minari/dataset.pyx":374
 * 
 *         """
 *         return len(self.episodes)             # <<<<<<<<<<<<<<
 * 
 *     def get_action_size(self):
 */
  __Pyx_TraceLine(374,0,__PYX_ERR(0, 374, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_episodes_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 374, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":367
 *         return self._episodes
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         """ Returns the number of episodes in the dataset.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":376
 *         return len(self.episodes)
 * 
 *     def get_action_size(self):             # <<<<<<<<<<<<<<
 *         """ Returns dimension of action-space.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_35get_action_size(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_34get_action_size[] = " Returns dimension of action-space.\n\n        If `discrete_action=True`, the return value will be the maximum index\n        +1 in the give actions.\n\n        Returns:\n            int: dimension of action-space.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_35get_action_size = {"get_action_size", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_35get_action_size, METH_O, __pyx_doc_6minari_7dataset_13MinariDataset_34get_action_size};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_35get_action_size(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_action_size (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_34get_action_size(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_34get_action_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__26)
  __Pyx_RefNannySetupContext("get_action_size", 0);
  __Pyx_TraceCall("get_action_size", __pyx_f[0], 376, 0, __PYX_ERR(0, 376, __pyx_L1_error));

  /* "minari/dataset.pyx":386
 * 
 *         """
 *         if self.discrete_action:             # <<<<<<<<<<<<<<
 *             return int(np.max(self._actions) + 1)
 *         return self._actions.shape[1]
 */
  __Pyx_TraceLine(386,0,__PYX_ERR(0, 386, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_discrete_action); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 386, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "minari/dataset.pyx":387
 *         """
 *         if self.discrete_action:
 *             return int(np.max(self._actions) + 1)             # <<<<<<<<<<<<<<
 *         return self._actions.shape[1]
 * 
 */
    __Pyx_TraceLine(387,0,__PYX_ERR(0, 387, __pyx_L1_error))
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_max); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_actions_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "minari/dataset.pyx":386
 * 
 *         """
 *         if self.discrete_action:             # <<<<<<<<<<<<<<
 *             return int(np.max(self._actions) + 1)
 *         return self._actions.shape[1]
 */
  }

  /* "minari/dataset.pyx":388
 *         if self.discrete_action:
 *             return int(np.max(self._actions) + 1)
 *         return self._actions.shape[1]             # <<<<<<<<<<<<<<
 * 
 *     def get_observation_shape(self):
 */
  __Pyx_TraceLine(388,0,__PYX_ERR(0, 388, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_actions_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":376
 *         return len(self.episodes)
 * 
 *     def get_action_size(self):             # <<<<<<<<<<<<<<
 *         """ Returns dimension of action-space.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.get_action_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":390
 *         return self._actions.shape[1]
 * 
 *     def get_observation_shape(self):             # <<<<<<<<<<<<<<
 *         """ Returns observation shape.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_37get_observation_shape(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_36get_observation_shape[] = " Returns observation shape.\n\n        Returns:\n            tuple: observation shape.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_37get_observation_shape = {"get_observation_shape", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_37get_observation_shape, METH_O, __pyx_doc_6minari_7dataset_13MinariDataset_36get_observation_shape};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_37get_observation_shape(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_observation_shape (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_36get_observation_shape(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_36get_observation_shape(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__27)
  __Pyx_RefNannySetupContext("get_observation_shape", 0);
  __Pyx_TraceCall("get_observation_shape", __pyx_f[0], 390, 0, __PYX_ERR(0, 390, __pyx_L1_error));

  /* "minari/dataset.pyx":397
 * 
 *         """
 *         return self._observations[0].shape             # <<<<<<<<<<<<<<
 * 
 *     def is_action_discrete(self):
 */
  __Pyx_TraceLine(397,0,__PYX_ERR(0, 397, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_observations_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":390
 *         return self._actions.shape[1]
 * 
 *     def get_observation_shape(self):             # <<<<<<<<<<<<<<
 *         """ Returns observation shape.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.get_observation_shape", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":399
 *         return self._observations[0].shape
 * 
 *     def is_action_discrete(self):             # <<<<<<<<<<<<<<
 *         """ Returns `discrete_action` flag.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_39is_action_discrete(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_38is_action_discrete[] = " Returns `discrete_action` flag.\n\n        Returns:\n            bool: `discrete_action` flag.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_39is_action_discrete = {"is_action_discrete", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_39is_action_discrete, METH_O, __pyx_doc_6minari_7dataset_13MinariDataset_38is_action_discrete};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_39is_action_discrete(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_action_discrete (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_38is_action_discrete(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_38is_action_discrete(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__28)
  __Pyx_RefNannySetupContext("is_action_discrete", 0);
  __Pyx_TraceCall("is_action_discrete", __pyx_f[0], 399, 0, __PYX_ERR(0, 399, __pyx_L1_error));

  /* "minari/dataset.pyx":406
 * 
 *         """
 *         return self.discrete_action             # <<<<<<<<<<<<<<
 * 
 *     def compute_stats(self):
 */
  __Pyx_TraceLine(406,0,__PYX_ERR(0, 406, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_discrete_action); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":399
 *         return self._observations[0].shape
 * 
 *     def is_action_discrete(self):             # <<<<<<<<<<<<<<
 *         """ Returns `discrete_action` flag.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.is_action_discrete", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":408
 *         return self.discrete_action
 * 
 *     def compute_stats(self):             # <<<<<<<<<<<<<<
 *         """ Computes statistics of the dataset.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_41compute_stats(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_40compute_stats[] = " Computes statistics of the dataset.\n\n        .. code-block:: python\n\n            stats = dataset.compute_stats()\n\n            # return statistics\n            stats['return']['mean']\n            stats['return']['std']\n            stats['return']['min']\n            stats['return']['max']\n\n            # reward statistics\n            stats['reward']['mean']\n            stats['reward']['std']\n            stats['reward']['min']\n            stats['reward']['max']\n\n            # action (only with continuous control actions)\n            stats['action']['mean']\n            stats['action']['std']\n            stats['action']['min']\n            stats['action']['max']\n\n            # observation (only with numpy.ndarray observations)\n            stats['observation']['mean']\n            stats['observation']['std']\n            stats['observation']['min']\n            stats['observation']['max']\n\n        Returns:\n            dict: statistics of the dataset.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_41compute_stats = {"compute_stats", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_41compute_stats, METH_O, __pyx_doc_6minari_7dataset_13MinariDataset_40compute_stats};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_41compute_stats(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("compute_stats (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_40compute_stats(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_40compute_stats(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_episode_returns = NULL;
  PyObject *__pyx_v_episode = NULL;
  PyObject *__pyx_v_stats = NULL;
  PyObject *__pyx_v_hists = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_freqs = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__29)
  __Pyx_RefNannySetupContext("compute_stats", 0);
  __Pyx_TraceCall("compute_stats", __pyx_f[0], 408, 0, __PYX_ERR(0, 408, __pyx_L1_error));

  /* "minari/dataset.pyx":443
 * 
 *         """
 *         episode_returns = []             # <<<<<<<<<<<<<<
 *         for episode in self.episodes:
 *             episode_returns.append(episode.compute_return())
 */
  __Pyx_TraceLine(443,0,__PYX_ERR(0, 443, __pyx_L1_error))
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_episode_returns = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "minari/dataset.pyx":444
 *         """
 *         episode_returns = []
 *         for episode in self.episodes:             # <<<<<<<<<<<<<<
 *             episode_returns.append(episode.compute_return())
 * 
 */
  __Pyx_TraceLine(444,0,__PYX_ERR(0, 444, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_episodes_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 444, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 444, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 444, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 444, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 444, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_episode, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "minari/dataset.pyx":445
 *         episode_returns = []
 *         for episode in self.episodes:
 *             episode_returns.append(episode.compute_return())             # <<<<<<<<<<<<<<
 * 
 *         stats = {
 */
    __Pyx_TraceLine(445,0,__PYX_ERR(0, 445, __pyx_L1_error))
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_episode, __pyx_n_s_compute_return); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_episode_returns, __pyx_t_1); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 445, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "minari/dataset.pyx":444
 *         """
 *         episode_returns = []
 *         for episode in self.episodes:             # <<<<<<<<<<<<<<
 *             episode_returns.append(episode.compute_return())
 * 
 */
    __Pyx_TraceLine(444,0,__PYX_ERR(0, 444, __pyx_L1_error))
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":448
 * 
 *         stats = {
 *             'return': {             # <<<<<<<<<<<<<<
 *                 'mean': np.mean(episode_returns),
 *                 'std': np.std(episode_returns),
 */
  __Pyx_TraceLine(448,0,__PYX_ERR(0, 448, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "minari/dataset.pyx":449
 *         stats = {
 *             'return': {
 *                 'mean': np.mean(episode_returns),             # <<<<<<<<<<<<<<
 *                 'std': np.std(episode_returns),
 *                 'min': np.min(episode_returns),
 */
  __Pyx_TraceLine(449,0,__PYX_ERR(0, 449, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_mean); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_v_episode_returns) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_episode_returns);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mean, __pyx_t_5) < 0) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "minari/dataset.pyx":450
 *             'return': {
 *                 'mean': np.mean(episode_returns),
 *                 'std': np.std(episode_returns),             # <<<<<<<<<<<<<<
 *                 'min': np.min(episode_returns),
 *                 'max': np.max(episode_returns),
 */
  __Pyx_TraceLine(450,0,__PYX_ERR(0, 450, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_std); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_v_episode_returns) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_episode_returns);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_std, __pyx_t_5) < 0) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "minari/dataset.pyx":451
 *                 'mean': np.mean(episode_returns),
 *                 'std': np.std(episode_returns),
 *                 'min': np.min(episode_returns),             # <<<<<<<<<<<<<<
 *                 'max': np.max(episode_returns),
 *                 'histogram': np.histogram(episode_returns, bins=20)
 */
  __Pyx_TraceLine(451,0,__PYX_ERR(0, 451, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_min); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_v_episode_returns) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_episode_returns);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_min, __pyx_t_5) < 0) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "minari/dataset.pyx":452
 *                 'std': np.std(episode_returns),
 *                 'min': np.min(episode_returns),
 *                 'max': np.max(episode_returns),             # <<<<<<<<<<<<<<
 *                 'histogram': np.histogram(episode_returns, bins=20)
 *             },
 */
  __Pyx_TraceLine(452,0,__PYX_ERR(0, 452, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_max); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_v_episode_returns) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_episode_returns);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max, __pyx_t_5) < 0) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "minari/dataset.pyx":453
 *                 'min': np.min(episode_returns),
 *                 'max': np.max(episode_returns),
 *                 'histogram': np.histogram(episode_returns, bins=20)             # <<<<<<<<<<<<<<
 *             },
 *             'reward': {
 */
  __Pyx_TraceLine(453,0,__PYX_ERR(0, 453, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_histogram); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_episode_returns);
  __Pyx_GIVEREF(__pyx_v_episode_returns);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_episode_returns);
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_bins, __pyx_int_20) < 0) __PYX_ERR(0, 453, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_histogram, __pyx_t_9) < 0) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_t_1) < 0) __PYX_ERR(0, 448, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":456
 *             },
 *             'reward': {
 *                 'mean': np.mean(self._rewards),             # <<<<<<<<<<<<<<
 *                 'std': np.std(self._rewards),
 *                 'min': np.min(self._rewards),
 */
  __Pyx_TraceLine(456,0,__PYX_ERR(0, 456, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_mean); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rewards_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_9 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mean, __pyx_t_9) < 0) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "minari/dataset.pyx":457
 *             'reward': {
 *                 'mean': np.mean(self._rewards),
 *                 'std': np.std(self._rewards),             # <<<<<<<<<<<<<<
 *                 'min': np.min(self._rewards),
 *                 'max': np.max(self._rewards),
 */
  __Pyx_TraceLine(457,0,__PYX_ERR(0, 457, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_std); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rewards_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_9 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_std, __pyx_t_9) < 0) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "minari/dataset.pyx":458
 *                 'mean': np.mean(self._rewards),
 *                 'std': np.std(self._rewards),
 *                 'min': np.min(self._rewards),             # <<<<<<<<<<<<<<
 *                 'max': np.max(self._rewards),
 *                 'histogram': np.histogram(self._rewards, bins=20)
 */
  __Pyx_TraceLine(458,0,__PYX_ERR(0, 458, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_min); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rewards_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_9 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_min, __pyx_t_9) < 0) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "minari/dataset.pyx":459
 *                 'std': np.std(self._rewards),
 *                 'min': np.min(self._rewards),
 *                 'max': np.max(self._rewards),             # <<<<<<<<<<<<<<
 *                 'histogram': np.histogram(self._rewards, bins=20)
 *             }
 */
  __Pyx_TraceLine(459,0,__PYX_ERR(0, 459, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_max); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rewards_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_9 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max, __pyx_t_9) < 0) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "minari/dataset.pyx":460
 *                 'min': np.min(self._rewards),
 *                 'max': np.max(self._rewards),
 *                 'histogram': np.histogram(self._rewards, bins=20)             # <<<<<<<<<<<<<<
 *             }
 *         }
 */
  __Pyx_TraceLine(460,0,__PYX_ERR(0, 460, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_histogram); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rewards_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_bins, __pyx_int_20) < 0) __PYX_ERR(0, 460, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_histogram, __pyx_t_6) < 0) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_reward, __pyx_t_1) < 0) __PYX_ERR(0, 448, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_stats = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "minari/dataset.pyx":465
 * 
 *         # only for continuous control task
 *         if not self.discrete_action:             # <<<<<<<<<<<<<<
 *             # calculate histogram on each dimension
 *             hists = []
 */
  __Pyx_TraceLine(465,0,__PYX_ERR(0, 465, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_discrete_action); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = ((!__pyx_t_10) != 0);
  if (__pyx_t_11) {

    /* "minari/dataset.pyx":467
 *         if not self.discrete_action:
 *             # calculate histogram on each dimension
 *             hists = []             # <<<<<<<<<<<<<<
 *             for i in range(self.get_action_size()):
 *                 hists.append(np.histogram(self.actions[:, i], bins=20))
 */
    __Pyx_TraceLine(467,0,__PYX_ERR(0, 467, __pyx_L1_error))
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 467, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_hists = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "minari/dataset.pyx":468
 *             # calculate histogram on each dimension
 *             hists = []
 *             for i in range(self.get_action_size()):             # <<<<<<<<<<<<<<
 *                 hists.append(np.histogram(self.actions[:, i], bins=20))
 *             stats['action'] = {
 */
    __Pyx_TraceLine(468,0,__PYX_ERR(0, 468, __pyx_L1_error))
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_action_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
      __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 468, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 468, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 468, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 468, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_4(__pyx_t_2);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 468, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "minari/dataset.pyx":469
 *             hists = []
 *             for i in range(self.get_action_size()):
 *                 hists.append(np.histogram(self.actions[:, i], bins=20))             # <<<<<<<<<<<<<<
 *             stats['action'] = {
 *                 'mean': np.mean(self.actions, axis=0),
 */
      __Pyx_TraceLine(469,0,__PYX_ERR(0, 469, __pyx_L1_error))
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_histogram); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_actions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_slice__30);
      __Pyx_GIVEREF(__pyx_slice__30);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_slice__30);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_i);
      __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_bins, __pyx_int_20) < 0) __PYX_ERR(0, 469, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_hists, __pyx_t_1); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 469, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "minari/dataset.pyx":468
 *             # calculate histogram on each dimension
 *             hists = []
 *             for i in range(self.get_action_size()):             # <<<<<<<<<<<<<<
 *                 hists.append(np.histogram(self.actions[:, i], bins=20))
 *             stats['action'] = {
 */
      __Pyx_TraceLine(468,0,__PYX_ERR(0, 468, __pyx_L1_error))
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "minari/dataset.pyx":471
 *                 hists.append(np.histogram(self.actions[:, i], bins=20))
 *             stats['action'] = {
 *                 'mean': np.mean(self.actions, axis=0),             # <<<<<<<<<<<<<<
 *                 'std': np.std(self.actions, axis=0),
 *                 'min': np.min(self.actions, axis=0),
 */
    __Pyx_TraceLine(471,0,__PYX_ERR(0, 471, __pyx_L1_error))
    __pyx_t_2 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_mean); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_actions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 471, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_mean, __pyx_t_6) < 0) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "minari/dataset.pyx":472
 *             stats['action'] = {
 *                 'mean': np.mean(self.actions, axis=0),
 *                 'std': np.std(self.actions, axis=0),             # <<<<<<<<<<<<<<
 *                 'min': np.min(self.actions, axis=0),
 *                 'max': np.max(self.actions, axis=0),
 */
    __Pyx_TraceLine(472,0,__PYX_ERR(0, 472, __pyx_L1_error))
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_std); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_actions); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 472, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_std, __pyx_t_5) < 0) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "minari/dataset.pyx":473
 *                 'mean': np.mean(self.actions, axis=0),
 *                 'std': np.std(self.actions, axis=0),
 *                 'min': np.min(self.actions, axis=0),             # <<<<<<<<<<<<<<
 *                 'max': np.max(self.actions, axis=0),
 *                 'histogram': hists
 */
    __Pyx_TraceLine(473,0,__PYX_ERR(0, 473, __pyx_L1_error))
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_actions); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 473, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_min, __pyx_t_1) < 0) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "minari/dataset.pyx":474
 *                 'std': np.std(self.actions, axis=0),
 *                 'min': np.min(self.actions, axis=0),
 *                 'max': np.max(self.actions, axis=0),             # <<<<<<<<<<<<<<
 *                 'histogram': hists
 *             }
 */
    __Pyx_TraceLine(474,0,__PYX_ERR(0, 474, __pyx_L1_error))
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_actions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 474, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_max, __pyx_t_6) < 0) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "minari/dataset.pyx":475
 *                 'min': np.min(self.actions, axis=0),
 *                 'max': np.max(self.actions, axis=0),
 *                 'histogram': hists             # <<<<<<<<<<<<<<
 *             }
 *         else:
 */
    __Pyx_TraceLine(475,0,__PYX_ERR(0, 475, __pyx_L1_error))
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_histogram, __pyx_v_hists) < 0) __PYX_ERR(0, 471, __pyx_L1_error)

    /* "minari/dataset.pyx":470
 *             for i in range(self.get_action_size()):
 *                 hists.append(np.histogram(self.actions[:, i], bins=20))
 *             stats['action'] = {             # <<<<<<<<<<<<<<
 *                 'mean': np.mean(self.actions, axis=0),
 *                 'std': np.std(self.actions, axis=0),
 */
    __Pyx_TraceLine(470,0,__PYX_ERR(0, 470, __pyx_L1_error))
    if (unlikely(PyDict_SetItem(__pyx_v_stats, __pyx_n_s_action, __pyx_t_2) < 0)) __PYX_ERR(0, 470, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "minari/dataset.pyx":465
 * 
 *         # only for continuous control task
 *         if not self.discrete_action:             # <<<<<<<<<<<<<<
 *             # calculate histogram on each dimension
 *             hists = []
 */
    goto __pyx_L5;
  }

  /* "minari/dataset.pyx":479
 *         else:
 *             # count frequency of discrete actions
 *             freqs = []             # <<<<<<<<<<<<<<
 *             for i in range(self.get_action_size()):
 *                 freqs.append((self.actions == i).sum())
 */
  __Pyx_TraceLine(479,0,__PYX_ERR(0, 479, __pyx_L1_error))
  /*else*/ {
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_freqs = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "minari/dataset.pyx":480
 *             # count frequency of discrete actions
 *             freqs = []
 *             for i in range(self.get_action_size()):             # <<<<<<<<<<<<<<
 *                 freqs.append((self.actions == i).sum())
 *             stats['action'] = {
 */
    __Pyx_TraceLine(480,0,__PYX_ERR(0, 480, __pyx_L1_error))
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_action_size); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
      __pyx_t_2 = __pyx_t_6; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
      __pyx_t_4 = NULL;
    } else {
      __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 480, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    for (;;) {
      if (likely(!__pyx_t_4)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 480, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 480, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        } else {
          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 480, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 480, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        }
      } else {
        __pyx_t_6 = __pyx_t_4(__pyx_t_2);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 480, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "minari/dataset.pyx":481
 *             freqs = []
 *             for i in range(self.get_action_size()):
 *                 freqs.append((self.actions == i).sum())             # <<<<<<<<<<<<<<
 *             stats['action'] = {
 *                 'histogram': [freqs, np.arange(self.get_action_size())]
 */
      __Pyx_TraceLine(481,0,__PYX_ERR(0, 481, __pyx_L1_error))
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_actions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = PyObject_RichCompare(__pyx_t_1, __pyx_v_i, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 481, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 481, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_freqs, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 481, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "minari/dataset.pyx":480
 *             # count frequency of discrete actions
 *             freqs = []
 *             for i in range(self.get_action_size()):             # <<<<<<<<<<<<<<
 *                 freqs.append((self.actions == i).sum())
 *             stats['action'] = {
 */
      __Pyx_TraceLine(480,0,__PYX_ERR(0, 480, __pyx_L1_error))
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "minari/dataset.pyx":483
 *                 freqs.append((self.actions == i).sum())
 *             stats['action'] = {
 *                 'histogram': [freqs, np.arange(self.get_action_size())]             # <<<<<<<<<<<<<<
 *             }
 * 
 */
    __Pyx_TraceLine(483,0,__PYX_ERR(0, 483, __pyx_L1_error))
    __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 483, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_arange); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 483, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_action_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 483, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_6 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 483, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 483, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_v_freqs);
    __Pyx_GIVEREF(__pyx_v_freqs);
    PyList_SET_ITEM(__pyx_t_9, 0, __pyx_v_freqs);
    __Pyx_GIVEREF(__pyx_t_6);
    PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_6);
    __pyx_t_6 = 0;
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_histogram, __pyx_t_9) < 0) __PYX_ERR(0, 483, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "minari/dataset.pyx":482
 *             for i in range(self.get_action_size()):
 *                 freqs.append((self.actions == i).sum())
 *             stats['action'] = {             # <<<<<<<<<<<<<<
 *                 'histogram': [freqs, np.arange(self.get_action_size())]
 *             }
 */
    __Pyx_TraceLine(482,0,__PYX_ERR(0, 482, __pyx_L1_error))
    if (unlikely(PyDict_SetItem(__pyx_v_stats, __pyx_n_s_action, __pyx_t_2) < 0)) __PYX_ERR(0, 482, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L5:;

  /* "minari/dataset.pyx":488
 *         # avoid large copy when observations are huge data.
 *         stats['observation'] = {
 *             'mean': np.mean(self.observations, axis=0),             # <<<<<<<<<<<<<<
 *             'std': np.std(self.observations, axis=0),
 *             'min': np.min(self.observations, axis=0),
 */
  __Pyx_TraceLine(488,0,__PYX_ERR(0, 488, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_mean); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_observations); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 488, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_mean, __pyx_t_5) < 0) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "minari/dataset.pyx":489
 *         stats['observation'] = {
 *             'mean': np.mean(self.observations, axis=0),
 *             'std': np.std(self.observations, axis=0),             # <<<<<<<<<<<<<<
 *             'min': np.min(self.observations, axis=0),
 *             'max': np.max(self.observations, axis=0),
 */
  __Pyx_TraceLine(489,0,__PYX_ERR(0, 489, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_std); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_observations); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 489, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_std, __pyx_t_6) < 0) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "minari/dataset.pyx":490
 *             'mean': np.mean(self.observations, axis=0),
 *             'std': np.std(self.observations, axis=0),
 *             'min': np.min(self.observations, axis=0),             # <<<<<<<<<<<<<<
 *             'max': np.max(self.observations, axis=0),
 *         }
 */
  __Pyx_TraceLine(490,0,__PYX_ERR(0, 490, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_min); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_observations); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 490, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_min, __pyx_t_9) < 0) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "minari/dataset.pyx":491
 *             'std': np.std(self.observations, axis=0),
 *             'min': np.min(self.observations, axis=0),
 *             'max': np.max(self.observations, axis=0),             # <<<<<<<<<<<<<<
 *         }
 * 
 */
  __Pyx_TraceLine(491,0,__PYX_ERR(0, 491, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_max); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_observations); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 491, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_max, __pyx_t_5) < 0) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "minari/dataset.pyx":487
 * 
 *         # avoid large copy when observations are huge data.
 *         stats['observation'] = {             # <<<<<<<<<<<<<<
 *             'mean': np.mean(self.observations, axis=0),
 *             'std': np.std(self.observations, axis=0),
 */
  __Pyx_TraceLine(487,0,__PYX_ERR(0, 487, __pyx_L1_error))
  if (unlikely(PyDict_SetItem(__pyx_v_stats, __pyx_n_s_observation, __pyx_t_2) < 0)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":494
 *         }
 * 
 *         return stats             # <<<<<<<<<<<<<<
 * 
 *     def append(
 */
  __Pyx_TraceLine(494,0,__PYX_ERR(0, 494, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_stats);
  __pyx_r = __pyx_v_stats;
  goto __pyx_L0;

  /* "minari/dataset.pyx":408
 *         return self.discrete_action
 * 
 *     def compute_stats(self):             # <<<<<<<<<<<<<<
 *         """ Computes statistics of the dataset.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_episode_returns);
  __Pyx_XDECREF(__pyx_v_episode);
  __Pyx_XDECREF(__pyx_v_stats);
  __Pyx_XDECREF(__pyx_v_hists);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_freqs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":496
 *         return stats
 * 
 *     def append(             # <<<<<<<<<<<<<<
 *         self,
 *         observations,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_43append(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_42append[] = " Appends new data.\n\n        Args:\n            observations (numpy.ndarray): N-D array.\n            actions (numpy.ndarray): actions.\n            rewards (numpy.ndarray): rewards.\n            terminals (numpy.ndarray): terminals.\n            episode_terminals (numpy.ndarray): episode terminals.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_43append = {"append", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6minari_7dataset_13MinariDataset_43append, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6minari_7dataset_13MinariDataset_42append};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_43append(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_observations = 0;
  PyObject *__pyx_v_actions = 0;
  PyObject *__pyx_v_rewards = 0;
  PyObject *__pyx_v_terminations = 0;
  PyObject *__pyx_v_truncations = 0;
  PyObject *__pyx_v_episode_terminals = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_observations,&__pyx_n_s_actions,&__pyx_n_s_rewards,&__pyx_n_s_terminations,&__pyx_n_s_truncations,&__pyx_n_s_episode_terminals,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};

    /* "minari/dataset.pyx":503
 *         terminations,
 *         truncations,
 *         episode_terminals=None             # <<<<<<<<<<<<<<
 *     ):
 *         """ Appends new data.
 */
    values[6] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_observations)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("append", 0, 6, 7, 1); __PYX_ERR(0, 496, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_actions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("append", 0, 6, 7, 2); __PYX_ERR(0, 496, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rewards)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("append", 0, 6, 7, 3); __PYX_ERR(0, 496, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_terminations)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("append", 0, 6, 7, 4); __PYX_ERR(0, 496, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_truncations)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("append", 0, 6, 7, 5); __PYX_ERR(0, 496, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_episode_terminals);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "append") < 0)) __PYX_ERR(0, 496, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_observations = values[1];
    __pyx_v_actions = values[2];
    __pyx_v_rewards = values[3];
    __pyx_v_terminations = values[4];
    __pyx_v_truncations = values[5];
    __pyx_v_episode_terminals = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("append", 0, 6, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 496, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("minari.dataset.MinariDataset.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_42append(__pyx_self, __pyx_v_self, __pyx_v_observations, __pyx_v_actions, __pyx_v_rewards, __pyx_v_terminations, __pyx_v_truncations, __pyx_v_episode_terminals);

  /* "minari/dataset.pyx":496
 *         return stats
 * 
 *     def append(             # <<<<<<<<<<<<<<
 *         self,
 *         observations,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_42append(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_observations, PyObject *__pyx_v_actions, PyObject *__pyx_v_rewards, PyObject *__pyx_v_terminations, PyObject *__pyx_v_truncations, PyObject *__pyx_v_episode_terminals) {
  PyObject *__pyx_v_observation = NULL;
  PyObject *__pyx_v_action = NULL;
  PyObject *__pyx_v_message = NULL;
  PyObject *__pyx_v_episodes = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_UCS4 __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__31)
  __Pyx_RefNannySetupContext("append", 0);
  __Pyx_TraceCall("append", __pyx_f[0], 496, 0, __PYX_ERR(0, 496, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_episode_terminals);

  /* "minari/dataset.pyx":516
 *         """
 *         # validation
 *         for observation, action in zip(observations, actions):             # <<<<<<<<<<<<<<
 *             assert observation.shape == self.get_observation_shape(),\
 *                 f'Observation shape must be {self.get_observation_shape()}.'
 */
  __Pyx_TraceLine(516,0,__PYX_ERR(0, 516, __pyx_L1_error))
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_observations);
  __Pyx_GIVEREF(__pyx_v_observations);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_observations);
  __Pyx_INCREF(__pyx_v_actions);
  __Pyx_GIVEREF(__pyx_v_actions);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_actions);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 516, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 516, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 516, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 516, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 516, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 516, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 516, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 516, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 516, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 516, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_observation, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_action, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "minari/dataset.pyx":517
 *         # validation
 *         for observation, action in zip(observations, actions):
 *             assert observation.shape == self.get_observation_shape(),\             # <<<<<<<<<<<<<<
 *                 f'Observation shape must be {self.get_observation_shape()}.'
 *             if self.discrete_action:
 */
    __Pyx_TraceLine(517,0,__PYX_ERR(0, 517, __pyx_L1_error))
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_observation, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 517, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_observation_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 517, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 517, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 517, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 517, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_9)) {

        /* "minari/dataset.pyx":518
 *         for observation, action in zip(observations, actions):
 *             assert observation.shape == self.get_observation_shape(),\
 *                 f'Observation shape must be {self.get_observation_shape()}.'             # <<<<<<<<<<<<<<
 *             if self.discrete_action:
 *                 if int(action) >= self.get_action_size():
 */
        __Pyx_TraceLine(518,0,__PYX_ERR(0, 518, __pyx_L1_error))
        __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 518, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_10 = 0;
        __pyx_t_11 = 127;
        __Pyx_INCREF(__pyx_kp_u_Observation_shape_must_be);
        __pyx_t_10 += 26;
        __Pyx_GIVEREF(__pyx_kp_u_Observation_shape_must_be);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Observation_shape_must_be);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_observation_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 518, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 518, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 518, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_11;
        __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_INCREF(__pyx_kp_u__32);
        __pyx_t_10 += 1;
        __Pyx_GIVEREF(__pyx_kp_u__32);
        PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__32);
        __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 518, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(0, 517, __pyx_L1_error)
      }
    }
    #endif

    /* "minari/dataset.pyx":519
 *             assert observation.shape == self.get_observation_shape(),\
 *                 f'Observation shape must be {self.get_observation_shape()}.'
 *             if self.discrete_action:             # <<<<<<<<<<<<<<
 *                 if int(action) >= self.get_action_size():
 *                     message = f'New action size is higher than' \
 */
    __Pyx_TraceLine(519,0,__PYX_ERR(0, 519, __pyx_L1_error))
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_discrete_action); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 519, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_9) {

      /* "minari/dataset.pyx":520
 *                 f'Observation shape must be {self.get_observation_shape()}.'
 *             if self.discrete_action:
 *                 if int(action) >= self.get_action_size():             # <<<<<<<<<<<<<<
 *                     message = f'New action size is higher than' \
 *                               f' {self.get_action_size()}.'
 */
      __Pyx_TraceLine(520,0,__PYX_ERR(0, 520, __pyx_L1_error))
      __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_v_action); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 520, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_action_size); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 520, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 520, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_GE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 520, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 520, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_9) {

        /* "minari/dataset.pyx":521
 *             if self.discrete_action:
 *                 if int(action) >= self.get_action_size():
 *                     message = f'New action size is higher than' \             # <<<<<<<<<<<<<<
 *                               f' {self.get_action_size()}.'
 *                     warnings.warn(message)
 */
        __Pyx_TraceLine(521,0,__PYX_ERR(0, 521, __pyx_L1_error))
        __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 521, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_10 = 0;
        __pyx_t_11 = 127;
        __Pyx_INCREF(__pyx_kp_u_New_action_size_is_higher_than);
        __pyx_t_10 += 31;
        __Pyx_GIVEREF(__pyx_kp_u_New_action_size_is_higher_than);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_New_action_size_is_higher_than);

        /* "minari/dataset.pyx":522
 *                 if int(action) >= self.get_action_size():
 *                     message = f'New action size is higher than' \
 *                               f' {self.get_action_size()}.'             # <<<<<<<<<<<<<<
 *                     warnings.warn(message)
 *             else:
 */
        __Pyx_TraceLine(522,0,__PYX_ERR(0, 522, __pyx_L1_error))
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_action_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 522, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 522, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 522, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_11;
        __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_INCREF(__pyx_kp_u__32);
        __pyx_t_10 += 1;
        __Pyx_GIVEREF(__pyx_kp_u__32);
        PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_u__32);

        /* "minari/dataset.pyx":521
 *             if self.discrete_action:
 *                 if int(action) >= self.get_action_size():
 *                     message = f'New action size is higher than' \             # <<<<<<<<<<<<<<
 *                               f' {self.get_action_size()}.'
 *                     warnings.warn(message)
 */
        __Pyx_TraceLine(521,0,__PYX_ERR(0, 521, __pyx_L1_error))
        __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 521, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF_SET(__pyx_v_message, ((PyObject*)__pyx_t_2));
        __pyx_t_2 = 0;

        /* "minari/dataset.pyx":523
 *                     message = f'New action size is higher than' \
 *                               f' {self.get_action_size()}.'
 *                     warnings.warn(message)             # <<<<<<<<<<<<<<
 *             else:
 *                 assert action.shape == (self.get_action_size(), ),\
 */
        __Pyx_TraceLine(523,0,__PYX_ERR(0, 523, __pyx_L1_error))
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_warnings); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 523, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_warn); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 523, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_message) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_message);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 523, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "minari/dataset.pyx":520
 *                 f'Observation shape must be {self.get_observation_shape()}.'
 *             if self.discrete_action:
 *                 if int(action) >= self.get_action_size():             # <<<<<<<<<<<<<<
 *                     message = f'New action size is higher than' \
 *                               f' {self.get_action_size()}.'
 */
      }

      /* "minari/dataset.pyx":519
 *             assert observation.shape == self.get_observation_shape(),\
 *                 f'Observation shape must be {self.get_observation_shape()}.'
 *             if self.discrete_action:             # <<<<<<<<<<<<<<
 *                 if int(action) >= self.get_action_size():
 *                     message = f'New action size is higher than' \
 */
      goto __pyx_L7;
    }

    /* "minari/dataset.pyx":525
 *                     warnings.warn(message)
 *             else:
 *                 assert action.shape == (self.get_action_size(), ),\             # <<<<<<<<<<<<<<
 *                     f'Action size must be {self.get_action_size()}.'
 * 
 */
    __Pyx_TraceLine(525,0,__PYX_ERR(0, 525, __pyx_L1_error))
    /*else*/ {
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_action, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 525, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_action_size); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 525, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 525, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 525, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
        __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 525, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 525, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_9)) {

          /* "minari/dataset.pyx":526
 *             else:
 *                 assert action.shape == (self.get_action_size(), ),\
 *                     f'Action size must be {self.get_action_size()}.'             # <<<<<<<<<<<<<<
 * 
 *         # append observations
 */
          __Pyx_TraceLine(526,0,__PYX_ERR(0, 526, __pyx_L1_error))
          __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 526, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_10 = 0;
          __pyx_t_11 = 127;
          __Pyx_INCREF(__pyx_kp_u_Action_size_must_be);
          __pyx_t_10 += 20;
          __Pyx_GIVEREF(__pyx_kp_u_Action_size_must_be);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Action_size_must_be);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_action_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 526, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 526, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 526, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_11;
          __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
          __pyx_t_2 = 0;
          __Pyx_INCREF(__pyx_kp_u__32);
          __pyx_t_10 += 1;
          __Pyx_GIVEREF(__pyx_kp_u__32);
          PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__32);
          __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 526, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(0, 525, __pyx_L1_error)
        }
      }
      #endif
    }
    __pyx_L7:;

    /* "minari/dataset.pyx":516
 *         """
 *         # validation
 *         for observation, action in zip(observations, actions):             # <<<<<<<<<<<<<<
 *             assert observation.shape == self.get_observation_shape(),\
 *                 f'Observation shape must be {self.get_observation_shape()}.'
 */
    __Pyx_TraceLine(516,0,__PYX_ERR(0, 516, __pyx_L1_error))
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":529
 * 
 *         # append observations
 *         self._observations = np.vstack([self._observations, observations])             # <<<<<<<<<<<<<<
 * 
 *         # append actions
 */
  __Pyx_TraceLine(529,0,__PYX_ERR(0, 529, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_vstack); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_observations_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_observations);
  __Pyx_GIVEREF(__pyx_v_observations);
  PyList_SET_ITEM(__pyx_t_6, 1, __pyx_v_observations);
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_observations_2, __pyx_t_1) < 0) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":532
 * 
 *         # append actions
 *         if self.discrete_action:             # <<<<<<<<<<<<<<
 *             self._actions = np.hstack([self._actions, actions])
 *         else:
 */
  __Pyx_TraceLine(532,0,__PYX_ERR(0, 532, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_discrete_action); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 532, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_9) {

    /* "minari/dataset.pyx":533
 *         # append actions
 *         if self.discrete_action:
 *             self._actions = np.hstack([self._actions, actions])             # <<<<<<<<<<<<<<
 *         else:
 *             self._actions = np.vstack([self._actions, actions])
 */
    __Pyx_TraceLine(533,0,__PYX_ERR(0, 533, __pyx_L1_error))
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_hstack); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_actions_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_5);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_actions);
    __Pyx_GIVEREF(__pyx_v_actions);
    PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_actions);
    __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_actions_2, __pyx_t_1) < 0) __PYX_ERR(0, 533, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "minari/dataset.pyx":532
 * 
 *         # append actions
 *         if self.discrete_action:             # <<<<<<<<<<<<<<
 *             self._actions = np.hstack([self._actions, actions])
 *         else:
 */
    goto __pyx_L9;
  }

  /* "minari/dataset.pyx":535
 *             self._actions = np.hstack([self._actions, actions])
 *         else:
 *             self._actions = np.vstack([self._actions, actions])             # <<<<<<<<<<<<<<
 * 
 *         # append rests
 */
  __Pyx_TraceLine(535,0,__PYX_ERR(0, 535, __pyx_L1_error))
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_vstack); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_actions_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
    __Pyx_INCREF(__pyx_v_actions);
    __Pyx_GIVEREF(__pyx_v_actions);
    PyList_SET_ITEM(__pyx_t_5, 1, __pyx_v_actions);
    __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_actions_2, __pyx_t_1) < 0) __PYX_ERR(0, 535, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L9:;

  /* "minari/dataset.pyx":538
 * 
 *         # append rests
 *         self._rewards = np.hstack([self._rewards, rewards])             # <<<<<<<<<<<<<<
 *         self._terminations = np.hstack([self._terminations, terminations])
 *         if episode_terminals is None:
 */
  __Pyx_TraceLine(538,0,__PYX_ERR(0, 538, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_hstack); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rewards_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_rewards);
  __Pyx_GIVEREF(__pyx_v_rewards);
  PyList_SET_ITEM(__pyx_t_6, 1, __pyx_v_rewards);
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_rewards_2, __pyx_t_1) < 0) __PYX_ERR(0, 538, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":539
 *         # append rests
 *         self._rewards = np.hstack([self._rewards, rewards])
 *         self._terminations = np.hstack([self._terminations, terminations])             # <<<<<<<<<<<<<<
 *         if episode_terminals is None:
 *             episode_terminals = terminations or truncations  # todo: check this (not sure it's refactored correctly)
 */
  __Pyx_TraceLine(539,0,__PYX_ERR(0, 539, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_hstack); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_terminations_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_5);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_terminations);
  __Pyx_GIVEREF(__pyx_v_terminations);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_terminations);
  __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_terminations_2, __pyx_t_1) < 0) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":540
 *         self._rewards = np.hstack([self._rewards, rewards])
 *         self._terminations = np.hstack([self._terminations, terminations])
 *         if episode_terminals is None:             # <<<<<<<<<<<<<<
 *             episode_terminals = terminations or truncations  # todo: check this (not sure it's refactored correctly)
 *         self._episode_terminals = np.hstack(
 */
  __Pyx_TraceLine(540,0,__PYX_ERR(0, 540, __pyx_L1_error))
  __pyx_t_9 = (__pyx_v_episode_terminals == Py_None);
  __pyx_t_12 = (__pyx_t_9 != 0);
  if (__pyx_t_12) {

    /* "minari/dataset.pyx":541
 *         self._terminations = np.hstack([self._terminations, terminations])
 *         if episode_terminals is None:
 *             episode_terminals = terminations or truncations  # todo: check this (not sure it's refactored correctly)             # <<<<<<<<<<<<<<
 *         self._episode_terminals = np.hstack(
 *             [self._episode_terminals, episode_terminals]
 */
    __Pyx_TraceLine(541,0,__PYX_ERR(0, 541, __pyx_L1_error))
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_terminations); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 541, __pyx_L1_error)
    if (!__pyx_t_12) {
    } else {
      __Pyx_INCREF(__pyx_v_terminations);
      __pyx_t_1 = __pyx_v_terminations;
      goto __pyx_L11_bool_binop_done;
    }
    __Pyx_INCREF(__pyx_v_truncations);
    __pyx_t_1 = __pyx_v_truncations;
    __pyx_L11_bool_binop_done:;
    __Pyx_DECREF_SET(__pyx_v_episode_terminals, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "minari/dataset.pyx":540
 *         self._rewards = np.hstack([self._rewards, rewards])
 *         self._terminations = np.hstack([self._terminations, terminations])
 *         if episode_terminals is None:             # <<<<<<<<<<<<<<
 *             episode_terminals = terminations or truncations  # todo: check this (not sure it's refactored correctly)
 *         self._episode_terminals = np.hstack(
 */
  }

  /* "minari/dataset.pyx":542
 *         if episode_terminals is None:
 *             episode_terminals = terminations or truncations  # todo: check this (not sure it's refactored correctly)
 *         self._episode_terminals = np.hstack(             # <<<<<<<<<<<<<<
 *             [self._episode_terminals, episode_terminals]
 *         )
 */
  __Pyx_TraceLine(542,0,__PYX_ERR(0, 542, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_hstack); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "minari/dataset.pyx":543
 *             episode_terminals = terminations or truncations  # todo: check this (not sure it's refactored correctly)
 *         self._episode_terminals = np.hstack(
 *             [self._episode_terminals, episode_terminals]             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __Pyx_TraceLine(543,0,__PYX_ERR(0, 543, __pyx_L1_error))
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_episode_terminals_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  __Pyx_INCREF(__pyx_v_episode_terminals);
  __Pyx_GIVEREF(__pyx_v_episode_terminals);
  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_v_episode_terminals);
  __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":542
 *         if episode_terminals is None:
 *             episode_terminals = terminations or truncations  # todo: check this (not sure it's refactored correctly)
 *         self._episode_terminals = np.hstack(             # <<<<<<<<<<<<<<
 *             [self._episode_terminals, episode_terminals]
 *         )
 */
  __Pyx_TraceLine(542,0,__PYX_ERR(0, 542, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_episode_terminals_2, __pyx_t_1) < 0) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":548
 * 
 *         # convert new data to list of episodes
 *         episodes = _to_episodes(             # <<<<<<<<<<<<<<
 *             observation_shape=self.get_observation_shape(),
 *             action_size=self.get_action_size(),
 */
  __Pyx_TraceLine(548,0,__PYX_ERR(0, 548, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_to_episodes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "minari/dataset.pyx":549
 *         # convert new data to list of episodes
 *         episodes = _to_episodes(
 *             observation_shape=self.get_observation_shape(),             # <<<<<<<<<<<<<<
 *             action_size=self.get_action_size(),
 *             observations=self._observations,
 */
  __Pyx_TraceLine(549,0,__PYX_ERR(0, 549, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_observation_shape); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_observation_shape, __pyx_t_5) < 0) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "minari/dataset.pyx":550
 *         episodes = _to_episodes(
 *             observation_shape=self.get_observation_shape(),
 *             action_size=self.get_action_size(),             # <<<<<<<<<<<<<<
 *             observations=self._observations,
 *             actions=self._actions,
 */
  __Pyx_TraceLine(550,0,__PYX_ERR(0, 550, __pyx_L1_error))
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_action_size); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_action_size, __pyx_t_5) < 0) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "minari/dataset.pyx":551
 *             observation_shape=self.get_observation_shape(),
 *             action_size=self.get_action_size(),
 *             observations=self._observations,             # <<<<<<<<<<<<<<
 *             actions=self._actions,
 *             rewards=self._rewards,
 */
  __Pyx_TraceLine(551,0,__PYX_ERR(0, 551, __pyx_L1_error))
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_observations_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_observations, __pyx_t_5) < 0) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "minari/dataset.pyx":552
 *             action_size=self.get_action_size(),
 *             observations=self._observations,
 *             actions=self._actions,             # <<<<<<<<<<<<<<
 *             rewards=self._rewards,
 *             terminations=self._terminations,
 */
  __Pyx_TraceLine(552,0,__PYX_ERR(0, 552, __pyx_L1_error))
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_actions_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_actions, __pyx_t_5) < 0) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "minari/dataset.pyx":553
 *             observations=self._observations,
 *             actions=self._actions,
 *             rewards=self._rewards,             # <<<<<<<<<<<<<<
 *             terminations=self._terminations,
 *             truncations=self._truncations,
 */
  __Pyx_TraceLine(553,0,__PYX_ERR(0, 553, __pyx_L1_error))
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rewards_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_rewards, __pyx_t_5) < 0) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "minari/dataset.pyx":554
 *             actions=self._actions,
 *             rewards=self._rewards,
 *             terminations=self._terminations,             # <<<<<<<<<<<<<<
 *             truncations=self._truncations,
 *             episode_terminals=self._episode_terminals,
 */
  __Pyx_TraceLine(554,0,__PYX_ERR(0, 554, __pyx_L1_error))
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_terminations_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_terminations, __pyx_t_5) < 0) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "minari/dataset.pyx":555
 *             rewards=self._rewards,
 *             terminations=self._terminations,
 *             truncations=self._truncations,             # <<<<<<<<<<<<<<
 *             episode_terminals=self._episode_terminals,
 *         )
 */
  __Pyx_TraceLine(555,0,__PYX_ERR(0, 555, __pyx_L1_error))
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_truncations_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_truncations, __pyx_t_5) < 0) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "minari/dataset.pyx":556
 *             terminations=self._terminations,
 *             truncations=self._truncations,
 *             episode_terminals=self._episode_terminals,             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __Pyx_TraceLine(556,0,__PYX_ERR(0, 556, __pyx_L1_error))
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_episode_terminals_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_episode_terminals, __pyx_t_5) < 0) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "minari/dataset.pyx":548
 * 
 *         # convert new data to list of episodes
 *         episodes = _to_episodes(             # <<<<<<<<<<<<<<
 *             observation_shape=self.get_observation_shape(),
 *             action_size=self.get_action_size(),
 */
  __Pyx_TraceLine(548,0,__PYX_ERR(0, 548, __pyx_L1_error))
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_episodes = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "minari/dataset.pyx":559
 *         )
 * 
 *         self._episodes = episodes             # <<<<<<<<<<<<<<
 * 
 *     def extend(self, dataset):
 */
  __Pyx_TraceLine(559,0,__PYX_ERR(0, 559, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_episodes, __pyx_v_episodes) < 0) __PYX_ERR(0, 559, __pyx_L1_error)

  /* "minari/dataset.pyx":496
 *         return stats
 * 
 *     def append(             # <<<<<<<<<<<<<<
 *         self,
 *         observations,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_observation);
  __Pyx_XDECREF(__pyx_v_action);
  __Pyx_XDECREF(__pyx_v_message);
  __Pyx_XDECREF(__pyx_v_episodes);
  __Pyx_XDECREF(__pyx_v_episode_terminals);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":561
 *         self._episodes = episodes
 * 
 *     def extend(self, dataset):             # <<<<<<<<<<<<<<
 *         """ Extend dataset by another dataset.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_45extend(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_44extend[] = " Extend dataset by another dataset.\n\n        Args:\n            dataset (minari.dataset.MinariDataset): dataset.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_45extend = {"extend", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6minari_7dataset_13MinariDataset_45extend, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6minari_7dataset_13MinariDataset_44extend};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_45extend(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_dataset = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_dataset,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataset)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("extend", 1, 2, 2, 1); __PYX_ERR(0, 561, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "extend") < 0)) __PYX_ERR(0, 561, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_dataset = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("extend", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 561, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("minari.dataset.MinariDataset.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_44extend(__pyx_self, __pyx_v_self, __pyx_v_dataset);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_44extend(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_dataset) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__33)
  __Pyx_RefNannySetupContext("extend", 0);
  __Pyx_TraceCall("extend", __pyx_f[0], 561, 0, __PYX_ERR(0, 561, __pyx_L1_error));

  /* "minari/dataset.pyx":568
 * 
 *         """
 *         assert self.is_action_discrete() == dataset.is_action_discrete(),\             # <<<<<<<<<<<<<<
 *             'Dataset must have discrete action-space.'
 *         assert self.get_observation_shape() == dataset.get_observation_shape(),\
 */
  __Pyx_TraceLine(568,0,__PYX_ERR(0, 568, __pyx_L1_error))
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_action_discrete); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 568, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s_is_action_discrete); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 568, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 568, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 568, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 568, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_5)) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Dataset_must_have_discrete_actio);
      __PYX_ERR(0, 568, __pyx_L1_error)
    }
  }
  #endif

  /* "minari/dataset.pyx":570
 *         assert self.is_action_discrete() == dataset.is_action_discrete(),\
 *             'Dataset must have discrete action-space.'
 *         assert self.get_observation_shape() == dataset.get_observation_shape(),\             # <<<<<<<<<<<<<<
 *             f'Observation shape must be {self.get_observation_shape()}'
 * 
 */
  __Pyx_TraceLine(570,0,__PYX_ERR(0, 570, __pyx_L1_error))
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_observation_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 570, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 570, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s_get_observation_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 570, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 570, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) {

      /* "minari/dataset.pyx":571
 *             'Dataset must have discrete action-space.'
 *         assert self.get_observation_shape() == dataset.get_observation_shape(),\
 *             f'Observation shape must be {self.get_observation_shape()}'             # <<<<<<<<<<<<<<
 * 
 *         self.append(
 */
      __Pyx_TraceLine(571,0,__PYX_ERR(0, 571, __pyx_L1_error))
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_observation_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Observation_shape_must_be, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 570, __pyx_L1_error)
    }
  }
  #endif

  /* "minari/dataset.pyx":573
 *             f'Observation shape must be {self.get_observation_shape()}'
 * 
 *         self.append(             # <<<<<<<<<<<<<<
 *             dataset.observations,
 *             dataset.actions,
 */
  __Pyx_TraceLine(573,0,__PYX_ERR(0, 573, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_append); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "minari/dataset.pyx":574
 * 
 *         self.append(
 *             dataset.observations,             # <<<<<<<<<<<<<<
 *             dataset.actions,
 *             dataset.rewards,
 */
  __Pyx_TraceLine(574,0,__PYX_ERR(0, 574, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s_observations); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "minari/dataset.pyx":575
 *         self.append(
 *             dataset.observations,
 *             dataset.actions,             # <<<<<<<<<<<<<<
 *             dataset.rewards,
 *             dataset.terminations,
 */
  __Pyx_TraceLine(575,0,__PYX_ERR(0, 575, __pyx_L1_error))
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s_actions); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "minari/dataset.pyx":576
 *             dataset.observations,
 *             dataset.actions,
 *             dataset.rewards,             # <<<<<<<<<<<<<<
 *             dataset.terminations,
 *             dataset.truncations,
 */
  __Pyx_TraceLine(576,0,__PYX_ERR(0, 576, __pyx_L1_error))
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s_rewards); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "minari/dataset.pyx":577
 *             dataset.actions,
 *             dataset.rewards,
 *             dataset.terminations,             # <<<<<<<<<<<<<<
 *             dataset.truncations,
 *             dataset.episode_terminals
 */
  __Pyx_TraceLine(577,0,__PYX_ERR(0, 577, __pyx_L1_error))
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s_terminations); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "minari/dataset.pyx":578
 *             dataset.rewards,
 *             dataset.terminations,
 *             dataset.truncations,             # <<<<<<<<<<<<<<
 *             dataset.episode_terminals
 *         )
 */
  __Pyx_TraceLine(578,0,__PYX_ERR(0, 578, __pyx_L1_error))
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s_truncations); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "minari/dataset.pyx":579
 *             dataset.terminations,
 *             dataset.truncations,
 *             dataset.episode_terminals             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __Pyx_TraceLine(579,0,__PYX_ERR(0, 579, __pyx_L1_error))
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s_episode_terminals); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[7] = {__pyx_t_10, __pyx_t_3, __pyx_t_4, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 6+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[7] = {__pyx_t_10, __pyx_t_3, __pyx_t_4, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 6+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_12 = PyTuple_New(6+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (__pyx_t_10) {
      __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_11, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_12, 4+__pyx_t_11, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_12, 5+__pyx_t_11, __pyx_t_9);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_9 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":561
 *         self._episodes = episodes
 * 
 *     def extend(self, dataset):             # <<<<<<<<<<<<<<
 *         """ Extend dataset by another dataset.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":582
 *         )
 * 
 *     def save(self):             # <<<<<<<<<<<<<<
 *         """ Saves dataset as HDF5.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_47save(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_46save[] = " Saves dataset as HDF5.\n\n        Args:\n            fname (str): file path.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_47save = {"save", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_47save, METH_O, __pyx_doc_6minari_7dataset_13MinariDataset_46save};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_47save(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("save (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_46save(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_46save(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_datasets_path = NULL;
  PyObject *__pyx_v_file_path = NULL;
  PyObject *__pyx_v_f = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__34)
  __Pyx_RefNannySetupContext("save", 0);
  __Pyx_TraceCall("save", __pyx_f[0], 582, 0, __PYX_ERR(0, 582, __pyx_L1_error));

  /* "minari/dataset.pyx":589
 * 
 *         """
 *         datasets_path = os.environ.get('MINARI_DATASETS_PATH')             # <<<<<<<<<<<<<<
 *         if datasets_path is not None:
 *             file_path = os.path.join(datasets_path, f'{self._dataset_name}.hdf5')
 */
  __Pyx_TraceLine(589,0,__PYX_ERR(0, 589, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_environ); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_n_s_MINARI_DATASETS_PATH) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_s_MINARI_DATASETS_PATH);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_datasets_path = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "minari/dataset.pyx":590
 *         """
 *         datasets_path = os.environ.get('MINARI_DATASETS_PATH')
 *         if datasets_path is not None:             # <<<<<<<<<<<<<<
 *             file_path = os.path.join(datasets_path, f'{self._dataset_name}.hdf5')
 *         else:
 */
  __Pyx_TraceLine(590,0,__PYX_ERR(0, 590, __pyx_L1_error))
  __pyx_t_4 = (__pyx_v_datasets_path != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "minari/dataset.pyx":591
 *         datasets_path = os.environ.get('MINARI_DATASETS_PATH')
 *         if datasets_path is not None:
 *             file_path = os.path.join(datasets_path, f'{self._dataset_name}.hdf5')             # <<<<<<<<<<<<<<
 *         else:
 *             datasets_path = os.path.join(os.path.expanduser('~'), '.minari', 'datasets')
 */
    __Pyx_TraceLine(591,0,__PYX_ERR(0, 591, __pyx_L1_error))
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dataset_name_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_t_6, __pyx_kp_u_hdf5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_datasets_path, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_datasets_path, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 591, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_v_datasets_path);
      __Pyx_GIVEREF(__pyx_v_datasets_path);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_datasets_path);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_file_path = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "minari/dataset.pyx":590
 *         """
 *         datasets_path = os.environ.get('MINARI_DATASETS_PATH')
 *         if datasets_path is not None:             # <<<<<<<<<<<<<<
 *             file_path = os.path.join(datasets_path, f'{self._dataset_name}.hdf5')
 *         else:
 */
    goto __pyx_L3;
  }

  /* "minari/dataset.pyx":593
 *             file_path = os.path.join(datasets_path, f'{self._dataset_name}.hdf5')
 *         else:
 *             datasets_path = os.path.join(os.path.expanduser('~'), '.minari', 'datasets')             # <<<<<<<<<<<<<<
 *             file_path = os.path.join(datasets_path, f'{self._dataset_name}.hdf5')
 * 
 */
  __Pyx_TraceLine(593,0,__PYX_ERR(0, 593, __pyx_L1_error))
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_path); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_expanduser); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_8 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_kp_s__35) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__35);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_8, __pyx_kp_s_minari, __pyx_n_s_datasets};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_8, __pyx_kp_s_minari, __pyx_n_s_datasets};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 593, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_8);
      __Pyx_INCREF(__pyx_kp_s_minari);
      __Pyx_GIVEREF(__pyx_kp_s_minari);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_kp_s_minari);
      __Pyx_INCREF(__pyx_n_s_datasets);
      __Pyx_GIVEREF(__pyx_n_s_datasets);
      PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_n_s_datasets);
      __pyx_t_8 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_datasets_path, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "minari/dataset.pyx":594
 *         else:
 *             datasets_path = os.path.join(os.path.expanduser('~'), '.minari', 'datasets')
 *             file_path = os.path.join(datasets_path, f'{self._dataset_name}.hdf5')             # <<<<<<<<<<<<<<
 * 
 *         os.makedirs(datasets_path, exist_ok=True)
 */
    __Pyx_TraceLine(594,0,__PYX_ERR(0, 594, __pyx_L1_error))
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dataset_name_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_t_8, __pyx_kp_u_hdf5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_datasets_path, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_datasets_path, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_INCREF(__pyx_v_datasets_path);
      __Pyx_GIVEREF(__pyx_v_datasets_path);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_7, __pyx_v_datasets_path);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_7, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_file_path = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "minari/dataset.pyx":596
 *             file_path = os.path.join(datasets_path, f'{self._dataset_name}.hdf5')
 * 
 *         os.makedirs(datasets_path, exist_ok=True)             # <<<<<<<<<<<<<<
 * 
 *         with h5py.File(file_path, 'w') as f:
 */
  __Pyx_TraceLine(596,0,__PYX_ERR(0, 596, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_makedirs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_datasets_path);
  __Pyx_GIVEREF(__pyx_v_datasets_path);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_datasets_path);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_exist_ok, Py_True) < 0) __PYX_ERR(0, 596, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "minari/dataset.pyx":598
 *         os.makedirs(datasets_path, exist_ok=True)
 * 
 *         with h5py.File(file_path, 'w') as f:             # <<<<<<<<<<<<<<
 *             f.create_dataset('dataset_name', data=self._dataset_name)
 *             f.create_dataset('algorithm_name', data=self._algorithm_name)
 */
  __Pyx_TraceLine(598,0,__PYX_ERR(0, 598, __pyx_L1_error))
  /*with:*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_h5py); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_File); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_file_path, __pyx_n_s_w};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 598, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_file_path, __pyx_n_s_w};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 598, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 598, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_v_file_path);
      __Pyx_GIVEREF(__pyx_v_file_path);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_7, __pyx_v_file_path);
      __Pyx_INCREF(__pyx_n_s_w);
      __Pyx_GIVEREF(__pyx_n_s_w);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_7, __pyx_n_s_w);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 598, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_9 = __Pyx_PyObject_LookupSpecial(__pyx_t_6, __pyx_n_s_exit); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_6, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 598, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 598, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        /*try:*/ {
          __pyx_v_f = __pyx_t_2;
          __pyx_t_2 = 0;

          /* "minari/dataset.pyx":599
 * 
 *         with h5py.File(file_path, 'w') as f:
 *             f.create_dataset('dataset_name', data=self._dataset_name)             # <<<<<<<<<<<<<<
 *             f.create_dataset('algorithm_name', data=self._algorithm_name)
 *             f.create_dataset('environment_name', data=self._environment_name)
 */
          __Pyx_TraceLine(599,0,__PYX_ERR(0, 599, __pyx_L8_error))
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 599, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 599, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dataset_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 599, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_t_1) < 0) __PYX_ERR(0, 599, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__36, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 599, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "minari/dataset.pyx":600
 *         with h5py.File(file_path, 'w') as f:
 *             f.create_dataset('dataset_name', data=self._dataset_name)
 *             f.create_dataset('algorithm_name', data=self._algorithm_name)             # <<<<<<<<<<<<<<
 *             f.create_dataset('environment_name', data=self._environment_name)
 *             f.create_dataset('environment_stack', data=str(self._environment_stack))
 */
          __Pyx_TraceLine(600,0,__PYX_ERR(0, 600, __pyx_L8_error))
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 600, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_algorithm_name_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_t_2) < 0) __PYX_ERR(0, 600, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__37, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "minari/dataset.pyx":601
 *             f.create_dataset('dataset_name', data=self._dataset_name)
 *             f.create_dataset('algorithm_name', data=self._algorithm_name)
 *             f.create_dataset('environment_name', data=self._environment_name)             # <<<<<<<<<<<<<<
 *             f.create_dataset('environment_stack', data=str(self._environment_stack))
 *             f.create_dataset('seed_used', data=self._seed_used)
 */
          __Pyx_TraceLine(601,0,__PYX_ERR(0, 601, __pyx_L8_error))
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 601, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 601, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_environment_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_t_1) < 0) __PYX_ERR(0, 601, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__38, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "minari/dataset.pyx":602
 *             f.create_dataset('algorithm_name', data=self._algorithm_name)
 *             f.create_dataset('environment_name', data=self._environment_name)
 *             f.create_dataset('environment_stack', data=str(self._environment_stack))             # <<<<<<<<<<<<<<
 *             f.create_dataset('seed_used', data=self._seed_used)
 *             f.create_dataset('code_permalink', data=str(self._code_permalink))  # allows saving of NoneType
 */
          __Pyx_TraceLine(602,0,__PYX_ERR(0, 602, __pyx_L8_error))
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 602, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 602, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_environment_stack_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 602, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 602, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_t_3) < 0) __PYX_ERR(0, 602, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__39, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 602, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "minari/dataset.pyx":603
 *             f.create_dataset('environment_name', data=self._environment_name)
 *             f.create_dataset('environment_stack', data=str(self._environment_stack))
 *             f.create_dataset('seed_used', data=self._seed_used)             # <<<<<<<<<<<<<<
 *             f.create_dataset('code_permalink', data=str(self._code_permalink))  # allows saving of NoneType
 *             f.create_dataset('author', data=str(self._author))
 */
          __Pyx_TraceLine(603,0,__PYX_ERR(0, 603, __pyx_L8_error))
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 603, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 603, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_seed_used_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_t_1) < 0) __PYX_ERR(0, 603, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__40, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "minari/dataset.pyx":604
 *             f.create_dataset('environment_stack', data=str(self._environment_stack))
 *             f.create_dataset('seed_used', data=self._seed_used)
 *             f.create_dataset('code_permalink', data=str(self._code_permalink))  # allows saving of NoneType             # <<<<<<<<<<<<<<
 *             f.create_dataset('author', data=str(self._author))
 *             f.create_dataset('author_email', data=str(self._author_email))
 */
          __Pyx_TraceLine(604,0,__PYX_ERR(0, 604, __pyx_L8_error))
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 604, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 604, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_code_permalink_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 604, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 604, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_t_2) < 0) __PYX_ERR(0, 604, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__41, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 604, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "minari/dataset.pyx":605
 *             f.create_dataset('seed_used', data=self._seed_used)
 *             f.create_dataset('code_permalink', data=str(self._code_permalink))  # allows saving of NoneType
 *             f.create_dataset('author', data=str(self._author))             # <<<<<<<<<<<<<<
 *             f.create_dataset('author_email', data=str(self._author_email))
 *             f.create_dataset('observations', data=self._observations)
 */
          __Pyx_TraceLine(605,0,__PYX_ERR(0, 605, __pyx_L8_error))
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 605, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 605, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_author_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 605, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 605, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_t_3) < 0) __PYX_ERR(0, 605, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__42, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 605, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "minari/dataset.pyx":606
 *             f.create_dataset('code_permalink', data=str(self._code_permalink))  # allows saving of NoneType
 *             f.create_dataset('author', data=str(self._author))
 *             f.create_dataset('author_email', data=str(self._author_email))             # <<<<<<<<<<<<<<
 *             f.create_dataset('observations', data=self._observations)
 *             f.create_dataset('actions', data=self._actions)
 */
          __Pyx_TraceLine(606,0,__PYX_ERR(0, 606, __pyx_L8_error))
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 606, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 606, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_author_email_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 606, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_t_1) < 0) __PYX_ERR(0, 606, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__43, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "minari/dataset.pyx":607
 *             f.create_dataset('author', data=str(self._author))
 *             f.create_dataset('author_email', data=str(self._author_email))
 *             f.create_dataset('observations', data=self._observations)             # <<<<<<<<<<<<<<
 *             f.create_dataset('actions', data=self._actions)
 *             f.create_dataset('rewards', data=self._rewards)
 */
          __Pyx_TraceLine(607,0,__PYX_ERR(0, 607, __pyx_L8_error))
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 607, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 607, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_observations_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 607, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_t_3) < 0) __PYX_ERR(0, 607, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__44, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 607, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "minari/dataset.pyx":608
 *             f.create_dataset('author_email', data=str(self._author_email))
 *             f.create_dataset('observations', data=self._observations)
 *             f.create_dataset('actions', data=self._actions)             # <<<<<<<<<<<<<<
 *             f.create_dataset('rewards', data=self._rewards)
 *             f.create_dataset('terminations', data=self._terminations)
 */
          __Pyx_TraceLine(608,0,__PYX_ERR(0, 608, __pyx_L8_error))
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 608, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_actions_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_t_1) < 0) __PYX_ERR(0, 608, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__45, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "minari/dataset.pyx":609
 *             f.create_dataset('observations', data=self._observations)
 *             f.create_dataset('actions', data=self._actions)
 *             f.create_dataset('rewards', data=self._rewards)             # <<<<<<<<<<<<<<
 *             f.create_dataset('terminations', data=self._terminations)
 *             f.create_dataset('truncations', data=self._truncations)
 */
          __Pyx_TraceLine(609,0,__PYX_ERR(0, 609, __pyx_L8_error))
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 609, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rewards_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_t_3) < 0) __PYX_ERR(0, 609, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__46, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "minari/dataset.pyx":610
 *             f.create_dataset('actions', data=self._actions)
 *             f.create_dataset('rewards', data=self._rewards)
 *             f.create_dataset('terminations', data=self._terminations)             # <<<<<<<<<<<<<<
 *             f.create_dataset('truncations', data=self._truncations)
 *             f.create_dataset('episode_terminals', data=self._episode_terminals)
 */
          __Pyx_TraceLine(610,0,__PYX_ERR(0, 610, __pyx_L8_error))
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 610, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 610, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_terminations_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_t_1) < 0) __PYX_ERR(0, 610, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__47, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "minari/dataset.pyx":611
 *             f.create_dataset('rewards', data=self._rewards)
 *             f.create_dataset('terminations', data=self._terminations)
 *             f.create_dataset('truncations', data=self._truncations)             # <<<<<<<<<<<<<<
 *             f.create_dataset('episode_terminals', data=self._episode_terminals)
 *             f.create_dataset('discrete_action', data=self.discrete_action)
 */
          __Pyx_TraceLine(611,0,__PYX_ERR(0, 611, __pyx_L8_error))
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 611, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_truncations_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_t_3) < 0) __PYX_ERR(0, 611, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__48, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "minari/dataset.pyx":612
 *             f.create_dataset('terminations', data=self._terminations)
 *             f.create_dataset('truncations', data=self._truncations)
 *             f.create_dataset('episode_terminals', data=self._episode_terminals)             # <<<<<<<<<<<<<<
 *             f.create_dataset('discrete_action', data=self.discrete_action)
 *             f.create_dataset('version', data='1.0')
 */
          __Pyx_TraceLine(612,0,__PYX_ERR(0, 612, __pyx_L8_error))
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 612, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 612, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_episode_terminals_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_t_1) < 0) __PYX_ERR(0, 612, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__49, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "minari/dataset.pyx":613
 *             f.create_dataset('truncations', data=self._truncations)
 *             f.create_dataset('episode_terminals', data=self._episode_terminals)
 *             f.create_dataset('discrete_action', data=self.discrete_action)             # <<<<<<<<<<<<<<
 *             f.create_dataset('version', data='1.0')
 *             f.flush()
 */
          __Pyx_TraceLine(613,0,__PYX_ERR(0, 613, __pyx_L8_error))
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 613, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_discrete_action); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_t_3) < 0) __PYX_ERR(0, 613, __pyx_L8_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__50, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "minari/dataset.pyx":614
 *             f.create_dataset('episode_terminals', data=self._episode_terminals)
 *             f.create_dataset('discrete_action', data=self.discrete_action)
 *             f.create_dataset('version', data='1.0')             # <<<<<<<<<<<<<<
 *             f.flush()
 * 
 */
          __Pyx_TraceLine(614,0,__PYX_ERR(0, 614, __pyx_L8_error))
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 614, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 614, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_data, __pyx_kp_s_1_0) < 0) __PYX_ERR(0, 614, __pyx_L8_error)
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__51, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "minari/dataset.pyx":615
 *             f.create_dataset('discrete_action', data=self.discrete_action)
 *             f.create_dataset('version', data='1.0')
 *             f.flush()             # <<<<<<<<<<<<<<
 * 
 *     @classmethod
 */
          __Pyx_TraceLine(615,0,__PYX_ERR(0, 615, __pyx_L8_error))
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_flush); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 615, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_3 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
            }
          }
          __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "minari/dataset.pyx":598
 *         os.makedirs(datasets_path, exist_ok=True)
 * 
 *         with h5py.File(file_path, 'w') as f:             # <<<<<<<<<<<<<<
 *             f.create_dataset('dataset_name', data=self._dataset_name)
 *             f.create_dataset('algorithm_name', data=self._algorithm_name)
 */
        }
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L13_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("minari.dataset.MinariDataset.save", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_6, &__pyx_t_3) < 0) __PYX_ERR(0, 598, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_2 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 598, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, NULL);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 598, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (__pyx_t_5 < 0) __PYX_ERR(0, 598, __pyx_L10_except_error)
          __pyx_t_4 = ((!(__pyx_t_5 != 0)) != 0);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_6);
            __Pyx_XGIVEREF(__pyx_t_3);
            __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_6, __pyx_t_3);
            __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_3 = 0; 
            __PYX_ERR(0, 598, __pyx_L10_except_error)
          }
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L9_exception_handled;
        }
        __pyx_L10_except_error:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        goto __pyx_L1_error;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        __pyx_L13_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_9) {
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__52, NULL);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 598, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        goto __pyx_L7;
      }
      __pyx_L7:;
    }
    goto __pyx_L17;
    __pyx_L4_error:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L1_error;
    __pyx_L17:;
  }

  /* "minari/dataset.pyx":582
 *         )
 * 
 *     def save(self):             # <<<<<<<<<<<<<<
 *         """ Saves dataset as HDF5.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.save", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_datasets_path);
  __Pyx_XDECREF(__pyx_v_file_path);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":618
 * 
 *     @classmethod
 *     def load(cls, fname):             # <<<<<<<<<<<<<<
 *         """ Loads dataset from HDF5.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_49load(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_48load[] = " Loads dataset from HDF5.\n\n        .. code-block:: python\n\n            import numpy as np\n            from minari.dataset import MinariDataset\n\n            dataset = MinariDataset(np.random.random(10, 4),\n                                 np.random.random(10, 2),\n                                 np.random.random(10),\n                                 np.random.randint(2, size=10))\n\n            # save as HDF5\n            dataset.dump('dataset.h5')\n\n            # load from HDF5\n            new_dataset = MinariDataset.load('dataset.h5')\n\n        Args:\n            fname (str): file path.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_49load = {"load", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6minari_7dataset_13MinariDataset_49load, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6minari_7dataset_13MinariDataset_48load};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_49load(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_fname = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("load (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_fname,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cls)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fname)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("load", 1, 2, 2, 1); __PYX_ERR(0, 618, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "load") < 0)) __PYX_ERR(0, 618, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_cls = values[0];
    __pyx_v_fname = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 618, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("minari.dataset.MinariDataset.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_48load(__pyx_self, __pyx_v_cls, __pyx_v_fname);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_48load(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_fname) {
  PyObject *__pyx_v_f = NULL;
  PyObject *__pyx_v_dataset_name = NULL;
  PyObject *__pyx_v_algorithm_name = NULL;
  PyObject *__pyx_v_environment_name = NULL;
  PyObject *__pyx_v_environment_stack = NULL;
  PyObject *__pyx_v_seed_used = NULL;
  PyObject *__pyx_v_code_permalink = NULL;
  PyObject *__pyx_v_author = NULL;
  PyObject *__pyx_v_author_email = NULL;
  PyObject *__pyx_v_observations = NULL;
  PyObject *__pyx_v_actions = NULL;
  PyObject *__pyx_v_rewards = NULL;
  PyObject *__pyx_v_terminations = NULL;
  PyObject *__pyx_v_truncations = NULL;
  PyObject *__pyx_v_discrete_action = NULL;
  PyObject *__pyx_v_episode_terminals = NULL;
  PyObject *__pyx_v_dataset = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__53)
  __Pyx_RefNannySetupContext("load", 0);
  __Pyx_TraceCall("load", __pyx_f[0], 618, 0, __PYX_ERR(0, 618, __pyx_L1_error));

  /* "minari/dataset.pyx":641
 * 
 *         """
 *         with h5py.File(fname, 'r') as f:             # <<<<<<<<<<<<<<
 *             dataset_name = f['dataset_name'][()]
 *             algorithm_name = f['algorithm_name'][()]
 */
  __Pyx_TraceLine(641,0,__PYX_ERR(0, 641, __pyx_L1_error))
  /*with:*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_h5py); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_File); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 641, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_fname, __pyx_n_s_r};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_fname, __pyx_n_s_r};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 641, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_fname);
      __Pyx_GIVEREF(__pyx_v_fname);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_fname);
      __Pyx_INCREF(__pyx_n_s_r);
      __Pyx_GIVEREF(__pyx_n_s_r);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_n_s_r);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 641, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 641, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 641, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {
          __pyx_v_f = __pyx_t_5;
          __pyx_t_5 = 0;

          /* "minari/dataset.pyx":642
 *         """
 *         with h5py.File(fname, 'r') as f:
 *             dataset_name = f['dataset_name'][()]             # <<<<<<<<<<<<<<
 *             algorithm_name = f['algorithm_name'][()]
 *             environment_name = f['environment_name'][()]
 */
          __Pyx_TraceLine(642,0,__PYX_ERR(0, 642, __pyx_L7_error))
          __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_f, __pyx_n_s_dataset_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 642, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_empty_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_v_dataset_name = __pyx_t_1;
          __pyx_t_1 = 0;

          /* "minari/dataset.pyx":643
 *         with h5py.File(fname, 'r') as f:
 *             dataset_name = f['dataset_name'][()]
 *             algorithm_name = f['algorithm_name'][()]             # <<<<<<<<<<<<<<
 *             environment_name = f['environment_name'][()]
 *             environment_stack = f['environment_stack'][()]
 */
          __Pyx_TraceLine(643,0,__PYX_ERR(0, 643, __pyx_L7_error))
          __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_f, __pyx_n_s_algorithm_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_empty_tuple); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 643, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_v_algorithm_name = __pyx_t_5;
          __pyx_t_5 = 0;

          /* "minari/dataset.pyx":644
 *             dataset_name = f['dataset_name'][()]
 *             algorithm_name = f['algorithm_name'][()]
 *             environment_name = f['environment_name'][()]             # <<<<<<<<<<<<<<
 *             environment_stack = f['environment_stack'][()]
 *             seed_used = f['seed_used'][()]
 */
          __Pyx_TraceLine(644,0,__PYX_ERR(0, 644, __pyx_L7_error))
          __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_f, __pyx_n_s_environment_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 644, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_empty_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_v_environment_name = __pyx_t_1;
          __pyx_t_1 = 0;

          /* "minari/dataset.pyx":645
 *             algorithm_name = f['algorithm_name'][()]
 *             environment_name = f['environment_name'][()]
 *             environment_stack = f['environment_stack'][()]             # <<<<<<<<<<<<<<
 *             seed_used = f['seed_used'][()]
 *             code_permalink = f['code_permalink'][()]
 */
          __Pyx_TraceLine(645,0,__PYX_ERR(0, 645, __pyx_L7_error))
          __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_f, __pyx_n_s_environment_stack); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_empty_tuple); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_v_environment_stack = __pyx_t_5;
          __pyx_t_5 = 0;

          /* "minari/dataset.pyx":646
 *             environment_name = f['environment_name'][()]
 *             environment_stack = f['environment_stack'][()]
 *             seed_used = f['seed_used'][()]             # <<<<<<<<<<<<<<
 *             code_permalink = f['code_permalink'][()]
 *             author = f['author'][()]
 */
          __Pyx_TraceLine(646,0,__PYX_ERR(0, 646, __pyx_L7_error))
          __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_f, __pyx_n_s_seed_used); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 646, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_empty_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 646, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_v_seed_used = __pyx_t_1;
          __pyx_t_1 = 0;

          /* "minari/dataset.pyx":647
 *             environment_stack = f['environment_stack'][()]
 *             seed_used = f['seed_used'][()]
 *             code_permalink = f['code_permalink'][()]             # <<<<<<<<<<<<<<
 *             author = f['author'][()]
 *             author_email = f['author_email'][()]
 */
          __Pyx_TraceLine(647,0,__PYX_ERR(0, 647, __pyx_L7_error))
          __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_f, __pyx_n_s_code_permalink); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_empty_tuple); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 647, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_v_code_permalink = __pyx_t_5;
          __pyx_t_5 = 0;

          /* "minari/dataset.pyx":648
 *             seed_used = f['seed_used'][()]
 *             code_permalink = f['code_permalink'][()]
 *             author = f['author'][()]             # <<<<<<<<<<<<<<
 *             author_email = f['author_email'][()]
 *             observations = f['observations'][()]
 */
          __Pyx_TraceLine(648,0,__PYX_ERR(0, 648, __pyx_L7_error))
          __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_f, __pyx_n_s_author); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 648, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_empty_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 648, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_v_author = __pyx_t_1;
          __pyx_t_1 = 0;

          /* "minari/dataset.pyx":649
 *             code_permalink = f['code_permalink'][()]
 *             author = f['author'][()]
 *             author_email = f['author_email'][()]             # <<<<<<<<<<<<<<
 *             observations = f['observations'][()]
 *             actions = f['actions'][()]
 */
          __Pyx_TraceLine(649,0,__PYX_ERR(0, 649, __pyx_L7_error))
          __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_f, __pyx_n_s_author_email); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 649, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_empty_tuple); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 649, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_v_author_email = __pyx_t_5;
          __pyx_t_5 = 0;

          /* "minari/dataset.pyx":650
 *             author = f['author'][()]
 *             author_email = f['author_email'][()]
 *             observations = f['observations'][()]             # <<<<<<<<<<<<<<
 *             actions = f['actions'][()]
 *             rewards = f['rewards'][()]
 */
          __Pyx_TraceLine(650,0,__PYX_ERR(0, 650, __pyx_L7_error))
          __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_f, __pyx_n_s_observations); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 650, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_empty_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 650, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_v_observations = __pyx_t_1;
          __pyx_t_1 = 0;

          /* "minari/dataset.pyx":651
 *             author_email = f['author_email'][()]
 *             observations = f['observations'][()]
 *             actions = f['actions'][()]             # <<<<<<<<<<<<<<
 *             rewards = f['rewards'][()]
 *             terminations = f['terminations'][()]
 */
          __Pyx_TraceLine(651,0,__PYX_ERR(0, 651, __pyx_L7_error))
          __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_f, __pyx_n_s_actions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 651, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_empty_tuple); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 651, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_v_actions = __pyx_t_5;
          __pyx_t_5 = 0;

          /* "minari/dataset.pyx":652
 *             observations = f['observations'][()]
 *             actions = f['actions'][()]
 *             rewards = f['rewards'][()]             # <<<<<<<<<<<<<<
 *             terminations = f['terminations'][()]
 *             truncations = f['truncations'][()]
 */
          __Pyx_TraceLine(652,0,__PYX_ERR(0, 652, __pyx_L7_error))
          __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_f, __pyx_n_s_rewards); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 652, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_empty_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 652, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_v_rewards = __pyx_t_1;
          __pyx_t_1 = 0;

          /* "minari/dataset.pyx":653
 *             actions = f['actions'][()]
 *             rewards = f['rewards'][()]
 *             terminations = f['terminations'][()]             # <<<<<<<<<<<<<<
 *             truncations = f['truncations'][()]
 *             discrete_action = f['discrete_action'][()]
 */
          __Pyx_TraceLine(653,0,__PYX_ERR(0, 653, __pyx_L7_error))
          __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_f, __pyx_n_s_terminations); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_empty_tuple); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 653, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_v_terminations = __pyx_t_5;
          __pyx_t_5 = 0;

          /* "minari/dataset.pyx":654
 *             rewards = f['rewards'][()]
 *             terminations = f['terminations'][()]
 *             truncations = f['truncations'][()]             # <<<<<<<<<<<<<<
 *             discrete_action = f['discrete_action'][()]
 * 
 */
          __Pyx_TraceLine(654,0,__PYX_ERR(0, 654, __pyx_L7_error))
          __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_f, __pyx_n_s_truncations); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 654, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_empty_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 654, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_v_truncations = __pyx_t_1;
          __pyx_t_1 = 0;

          /* "minari/dataset.pyx":655
 *             terminations = f['terminations'][()]
 *             truncations = f['truncations'][()]
 *             discrete_action = f['discrete_action'][()]             # <<<<<<<<<<<<<<
 * 
 *             # for backward compatibility
 */
          __Pyx_TraceLine(655,0,__PYX_ERR(0, 655, __pyx_L7_error))
          __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_f, __pyx_n_s_discrete_action); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_empty_tuple); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 655, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_v_discrete_action = __pyx_t_5;
          __pyx_t_5 = 0;

          /* "minari/dataset.pyx":658
 * 
 *             # for backward compatibility
 *             if 'episode_terminals' in f:             # <<<<<<<<<<<<<<
 *                 episode_terminals = f['episode_terminals'][()]
 *             else:
 */
          __Pyx_TraceLine(658,0,__PYX_ERR(0, 658, __pyx_L7_error))
          __pyx_t_10 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_episode_terminals, __pyx_v_f, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 658, __pyx_L7_error)
          __pyx_t_11 = (__pyx_t_10 != 0);
          if (__pyx_t_11) {

            /* "minari/dataset.pyx":659
 *             # for backward compatibility
 *             if 'episode_terminals' in f:
 *                 episode_terminals = f['episode_terminals'][()]             # <<<<<<<<<<<<<<
 *             else:
 *                 episode_terminals = None
 */
            __Pyx_TraceLine(659,0,__PYX_ERR(0, 659, __pyx_L7_error))
            __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_f, __pyx_n_s_episode_terminals); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 659, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_empty_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __pyx_v_episode_terminals = __pyx_t_1;
            __pyx_t_1 = 0;

            /* "minari/dataset.pyx":658
 * 
 *             # for backward compatibility
 *             if 'episode_terminals' in f:             # <<<<<<<<<<<<<<
 *                 episode_terminals = f['episode_terminals'][()]
 *             else:
 */
            goto __pyx_L13;
          }

          /* "minari/dataset.pyx":661
 *                 episode_terminals = f['episode_terminals'][()]
 *             else:
 *                 episode_terminals = None             # <<<<<<<<<<<<<<
 * 
 *             if 'version' not in f:
 */
          __Pyx_TraceLine(661,0,__PYX_ERR(0, 661, __pyx_L7_error))
          /*else*/ {
            __Pyx_INCREF(Py_None);
            __pyx_v_episode_terminals = Py_None;
          }
          __pyx_L13:;

          /* "minari/dataset.pyx":663
 *                 episode_terminals = None
 * 
 *             if 'version' not in f:             # <<<<<<<<<<<<<<
 *                 LOG.warning("The dataset structure might be incompatible.")
 * 
 */
          __Pyx_TraceLine(663,0,__PYX_ERR(0, 663, __pyx_L7_error))
          __pyx_t_11 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_version, __pyx_v_f, Py_NE)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 663, __pyx_L7_error)
          __pyx_t_10 = (__pyx_t_11 != 0);
          if (__pyx_t_10) {

            /* "minari/dataset.pyx":664
 * 
 *             if 'version' not in f:
 *                 LOG.warning("The dataset structure might be incompatible.")             # <<<<<<<<<<<<<<
 * 
 *         dataset = cls(
 */
            __Pyx_TraceLine(664,0,__PYX_ERR(0, 664, __pyx_L7_error))
            __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_LOG); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 664, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_warning); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 664, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __pyx_t_5 = NULL;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
              __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
              if (likely(__pyx_t_5)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
                __Pyx_INCREF(__pyx_t_5);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_3, function);
              }
            }
            __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s_The_dataset_structure_might_be_i) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_The_dataset_structure_might_be_i);
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

            /* "minari/dataset.pyx":663
 *                 episode_terminals = None
 * 
 *             if 'version' not in f:             # <<<<<<<<<<<<<<
 *                 LOG.warning("The dataset structure might be incompatible.")
 * 
 */
          }

          /* "minari/dataset.pyx":641
 * 
 *         """
 *         with h5py.File(fname, 'r') as f:             # <<<<<<<<<<<<<<
 *             dataset_name = f['dataset_name'][()]
 *             algorithm_name = f['algorithm_name'][()]
 */
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L12_try_end;
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("minari.dataset.MinariDataset.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 641, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_2 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 641, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (__pyx_t_10 < 0) __PYX_ERR(0, 641, __pyx_L9_except_error)
          __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_3);
            __Pyx_XGIVEREF(__pyx_t_5);
            __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_3, __pyx_t_5);
            __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; 
            __PYX_ERR(0, 641, __pyx_L9_except_error)
          }
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        __pyx_L12_try_end:;
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_6) {
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__52, NULL);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 641, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    goto __pyx_L18;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L1_error;
    __pyx_L18:;
  }

  /* "minari/dataset.pyx":667
 * 
 *         dataset = cls(
 *             dataset_name=dataset_name,             # <<<<<<<<<<<<<<
 *             algorithm_name=algorithm_name,
 *             environment_name=environment_name,
 */
  __Pyx_TraceLine(667,0,__PYX_ERR(0, 667, __pyx_L1_error))
  __pyx_t_5 = __Pyx_PyDict_NewPresized(15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (unlikely(!__pyx_v_dataset_name)) { __Pyx_RaiseUnboundLocalError("dataset_name"); __PYX_ERR(0, 667, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dataset_name, __pyx_v_dataset_name) < 0) __PYX_ERR(0, 667, __pyx_L1_error)

  /* "minari/dataset.pyx":668
 *         dataset = cls(
 *             dataset_name=dataset_name,
 *             algorithm_name=algorithm_name,             # <<<<<<<<<<<<<<
 *             environment_name=environment_name,
 *             environment_stack=environment_stack,
 */
  __Pyx_TraceLine(668,0,__PYX_ERR(0, 668, __pyx_L1_error))
  if (unlikely(!__pyx_v_algorithm_name)) { __Pyx_RaiseUnboundLocalError("algorithm_name"); __PYX_ERR(0, 668, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_algorithm_name, __pyx_v_algorithm_name) < 0) __PYX_ERR(0, 667, __pyx_L1_error)

  /* "minari/dataset.pyx":669
 *             dataset_name=dataset_name,
 *             algorithm_name=algorithm_name,
 *             environment_name=environment_name,             # <<<<<<<<<<<<<<
 *             environment_stack=environment_stack,
 *             seed_used=seed_used,
 */
  __Pyx_TraceLine(669,0,__PYX_ERR(0, 669, __pyx_L1_error))
  if (unlikely(!__pyx_v_environment_name)) { __Pyx_RaiseUnboundLocalError("environment_name"); __PYX_ERR(0, 669, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_environment_name, __pyx_v_environment_name) < 0) __PYX_ERR(0, 667, __pyx_L1_error)

  /* "minari/dataset.pyx":670
 *             algorithm_name=algorithm_name,
 *             environment_name=environment_name,
 *             environment_stack=environment_stack,             # <<<<<<<<<<<<<<
 *             seed_used=seed_used,
 *             code_permalink=code_permalink,
 */
  __Pyx_TraceLine(670,0,__PYX_ERR(0, 670, __pyx_L1_error))
  if (unlikely(!__pyx_v_environment_stack)) { __Pyx_RaiseUnboundLocalError("environment_stack"); __PYX_ERR(0, 670, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_environment_stack, __pyx_v_environment_stack) < 0) __PYX_ERR(0, 667, __pyx_L1_error)

  /* "minari/dataset.pyx":671
 *             environment_name=environment_name,
 *             environment_stack=environment_stack,
 *             seed_used=seed_used,             # <<<<<<<<<<<<<<
 *             code_permalink=code_permalink,
 *             author=author,
 */
  __Pyx_TraceLine(671,0,__PYX_ERR(0, 671, __pyx_L1_error))
  if (unlikely(!__pyx_v_seed_used)) { __Pyx_RaiseUnboundLocalError("seed_used"); __PYX_ERR(0, 671, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_seed_used, __pyx_v_seed_used) < 0) __PYX_ERR(0, 667, __pyx_L1_error)

  /* "minari/dataset.pyx":672
 *             environment_stack=environment_stack,
 *             seed_used=seed_used,
 *             code_permalink=code_permalink,             # <<<<<<<<<<<<<<
 *             author=author,
 *             author_email=author_email,
 */
  __Pyx_TraceLine(672,0,__PYX_ERR(0, 672, __pyx_L1_error))
  if (unlikely(!__pyx_v_code_permalink)) { __Pyx_RaiseUnboundLocalError("code_permalink"); __PYX_ERR(0, 672, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_code_permalink, __pyx_v_code_permalink) < 0) __PYX_ERR(0, 667, __pyx_L1_error)

  /* "minari/dataset.pyx":673
 *             seed_used=seed_used,
 *             code_permalink=code_permalink,
 *             author=author,             # <<<<<<<<<<<<<<
 *             author_email=author_email,
 *             observations=observations,
 */
  __Pyx_TraceLine(673,0,__PYX_ERR(0, 673, __pyx_L1_error))
  if (unlikely(!__pyx_v_author)) { __Pyx_RaiseUnboundLocalError("author"); __PYX_ERR(0, 673, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_author, __pyx_v_author) < 0) __PYX_ERR(0, 667, __pyx_L1_error)

  /* "minari/dataset.pyx":674
 *             code_permalink=code_permalink,
 *             author=author,
 *             author_email=author_email,             # <<<<<<<<<<<<<<
 *             observations=observations,
 *             actions=actions,
 */
  __Pyx_TraceLine(674,0,__PYX_ERR(0, 674, __pyx_L1_error))
  if (unlikely(!__pyx_v_author_email)) { __Pyx_RaiseUnboundLocalError("author_email"); __PYX_ERR(0, 674, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_author_email, __pyx_v_author_email) < 0) __PYX_ERR(0, 667, __pyx_L1_error)

  /* "minari/dataset.pyx":675
 *             author=author,
 *             author_email=author_email,
 *             observations=observations,             # <<<<<<<<<<<<<<
 *             actions=actions,
 *             rewards=rewards,
 */
  __Pyx_TraceLine(675,0,__PYX_ERR(0, 675, __pyx_L1_error))
  if (unlikely(!__pyx_v_observations)) { __Pyx_RaiseUnboundLocalError("observations"); __PYX_ERR(0, 675, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_observations, __pyx_v_observations) < 0) __PYX_ERR(0, 667, __pyx_L1_error)

  /* "minari/dataset.pyx":676
 *             author_email=author_email,
 *             observations=observations,
 *             actions=actions,             # <<<<<<<<<<<<<<
 *             rewards=rewards,
 *             terminations=terminations,
 */
  __Pyx_TraceLine(676,0,__PYX_ERR(0, 676, __pyx_L1_error))
  if (unlikely(!__pyx_v_actions)) { __Pyx_RaiseUnboundLocalError("actions"); __PYX_ERR(0, 676, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_actions, __pyx_v_actions) < 0) __PYX_ERR(0, 667, __pyx_L1_error)

  /* "minari/dataset.pyx":677
 *             observations=observations,
 *             actions=actions,
 *             rewards=rewards,             # <<<<<<<<<<<<<<
 *             terminations=terminations,
 *             truncations=truncations,
 */
  __Pyx_TraceLine(677,0,__PYX_ERR(0, 677, __pyx_L1_error))
  if (unlikely(!__pyx_v_rewards)) { __Pyx_RaiseUnboundLocalError("rewards"); __PYX_ERR(0, 677, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_rewards, __pyx_v_rewards) < 0) __PYX_ERR(0, 667, __pyx_L1_error)

  /* "minari/dataset.pyx":678
 *             actions=actions,
 *             rewards=rewards,
 *             terminations=terminations,             # <<<<<<<<<<<<<<
 *             truncations=truncations,
 *             episode_terminals=episode_terminals,
 */
  __Pyx_TraceLine(678,0,__PYX_ERR(0, 678, __pyx_L1_error))
  if (unlikely(!__pyx_v_terminations)) { __Pyx_RaiseUnboundLocalError("terminations"); __PYX_ERR(0, 678, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_terminations, __pyx_v_terminations) < 0) __PYX_ERR(0, 667, __pyx_L1_error)

  /* "minari/dataset.pyx":679
 *             rewards=rewards,
 *             terminations=terminations,
 *             truncations=truncations,             # <<<<<<<<<<<<<<
 *             episode_terminals=episode_terminals,
 *             discrete_action=discrete_action,
 */
  __Pyx_TraceLine(679,0,__PYX_ERR(0, 679, __pyx_L1_error))
  if (unlikely(!__pyx_v_truncations)) { __Pyx_RaiseUnboundLocalError("truncations"); __PYX_ERR(0, 679, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_truncations, __pyx_v_truncations) < 0) __PYX_ERR(0, 667, __pyx_L1_error)

  /* "minari/dataset.pyx":680
 *             terminations=terminations,
 *             truncations=truncations,
 *             episode_terminals=episode_terminals,             # <<<<<<<<<<<<<<
 *             discrete_action=discrete_action,
 *         )
 */
  __Pyx_TraceLine(680,0,__PYX_ERR(0, 680, __pyx_L1_error))
  if (unlikely(!__pyx_v_episode_terminals)) { __Pyx_RaiseUnboundLocalError("episode_terminals"); __PYX_ERR(0, 680, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_episode_terminals, __pyx_v_episode_terminals) < 0) __PYX_ERR(0, 667, __pyx_L1_error)

  /* "minari/dataset.pyx":681
 *             truncations=truncations,
 *             episode_terminals=episode_terminals,
 *             discrete_action=discrete_action,             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __Pyx_TraceLine(681,0,__PYX_ERR(0, 681, __pyx_L1_error))
  if (unlikely(!__pyx_v_discrete_action)) { __Pyx_RaiseUnboundLocalError("discrete_action"); __PYX_ERR(0, 681, __pyx_L1_error) }
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_discrete_action, __pyx_v_discrete_action) < 0) __PYX_ERR(0, 667, __pyx_L1_error)

  /* "minari/dataset.pyx":666
 *                 LOG.warning("The dataset structure might be incompatible.")
 * 
 *         dataset = cls(             # <<<<<<<<<<<<<<
 *             dataset_name=dataset_name,
 *             algorithm_name=algorithm_name,
 */
  __Pyx_TraceLine(666,0,__PYX_ERR(0, 666, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_cls, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_dataset = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "minari/dataset.pyx":684
 *         )
 * 
 *         return dataset             # <<<<<<<<<<<<<<
 * 
 *     def build_episodes(self):
 */
  __Pyx_TraceLine(684,0,__PYX_ERR(0, 684, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_dataset);
  __pyx_r = __pyx_v_dataset;
  goto __pyx_L0;

  /* "minari/dataset.pyx":618
 * 
 *     @classmethod
 *     def load(cls, fname):             # <<<<<<<<<<<<<<
 *         """ Loads dataset from HDF5.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_dataset_name);
  __Pyx_XDECREF(__pyx_v_algorithm_name);
  __Pyx_XDECREF(__pyx_v_environment_name);
  __Pyx_XDECREF(__pyx_v_environment_stack);
  __Pyx_XDECREF(__pyx_v_seed_used);
  __Pyx_XDECREF(__pyx_v_code_permalink);
  __Pyx_XDECREF(__pyx_v_author);
  __Pyx_XDECREF(__pyx_v_author_email);
  __Pyx_XDECREF(__pyx_v_observations);
  __Pyx_XDECREF(__pyx_v_actions);
  __Pyx_XDECREF(__pyx_v_rewards);
  __Pyx_XDECREF(__pyx_v_terminations);
  __Pyx_XDECREF(__pyx_v_truncations);
  __Pyx_XDECREF(__pyx_v_discrete_action);
  __Pyx_XDECREF(__pyx_v_episode_terminals);
  __Pyx_XDECREF(__pyx_v_dataset);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":686
 *         return dataset
 * 
 *     def build_episodes(self):             # <<<<<<<<<<<<<<
 *         """ Builds episode objects.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_51build_episodes(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_13MinariDataset_50build_episodes[] = " Builds episode objects.\n\n        This method will be internally called when accessing the episodes\n        property at the first time.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_51build_episodes = {"build_episodes", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_51build_episodes, METH_O, __pyx_doc_6minari_7dataset_13MinariDataset_50build_episodes};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_51build_episodes(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("build_episodes (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_50build_episodes(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_50build_episodes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__54)
  __Pyx_RefNannySetupContext("build_episodes", 0);
  __Pyx_TraceCall("build_episodes", __pyx_f[0], 686, 0, __PYX_ERR(0, 686, __pyx_L1_error));

  /* "minari/dataset.pyx":693
 * 
 *         """
 *         self._episodes = _to_episodes(             # <<<<<<<<<<<<<<
 *             observation_shape=self.get_observation_shape(),
 *             action_size=self.get_action_size(),
 */
  __Pyx_TraceLine(693,0,__PYX_ERR(0, 693, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_to_episodes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "minari/dataset.pyx":694
 *         """
 *         self._episodes = _to_episodes(
 *             observation_shape=self.get_observation_shape(),             # <<<<<<<<<<<<<<
 *             action_size=self.get_action_size(),
 *             observations=self._observations,
 */
  __Pyx_TraceLine(694,0,__PYX_ERR(0, 694, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_observation_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_observation_shape, __pyx_t_3) < 0) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":695
 *         self._episodes = _to_episodes(
 *             observation_shape=self.get_observation_shape(),
 *             action_size=self.get_action_size(),             # <<<<<<<<<<<<<<
 *             observations=self._observations,
 *             actions=self._actions,
 */
  __Pyx_TraceLine(695,0,__PYX_ERR(0, 695, __pyx_L1_error))
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_action_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 695, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 695, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_action_size, __pyx_t_3) < 0) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":696
 *             observation_shape=self.get_observation_shape(),
 *             action_size=self.get_action_size(),
 *             observations=self._observations,             # <<<<<<<<<<<<<<
 *             actions=self._actions,
 *             rewards=self._rewards,
 */
  __Pyx_TraceLine(696,0,__PYX_ERR(0, 696, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_observations_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_observations, __pyx_t_3) < 0) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":697
 *             action_size=self.get_action_size(),
 *             observations=self._observations,
 *             actions=self._actions,             # <<<<<<<<<<<<<<
 *             rewards=self._rewards,
 *             terminations=self._terminations,
 */
  __Pyx_TraceLine(697,0,__PYX_ERR(0, 697, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_actions_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_actions, __pyx_t_3) < 0) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":698
 *             observations=self._observations,
 *             actions=self._actions,
 *             rewards=self._rewards,             # <<<<<<<<<<<<<<
 *             terminations=self._terminations,
 *             truncations=self.truncations,
 */
  __Pyx_TraceLine(698,0,__PYX_ERR(0, 698, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rewards_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_rewards, __pyx_t_3) < 0) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":699
 *             actions=self._actions,
 *             rewards=self._rewards,
 *             terminations=self._terminations,             # <<<<<<<<<<<<<<
 *             truncations=self.truncations,
 *             episode_terminals=self._episode_terminals,
 */
  __Pyx_TraceLine(699,0,__PYX_ERR(0, 699, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_terminations_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_terminations, __pyx_t_3) < 0) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":700
 *             rewards=self._rewards,
 *             terminations=self._terminations,
 *             truncations=self.truncations,             # <<<<<<<<<<<<<<
 *             episode_terminals=self._episode_terminals,
 *         )
 */
  __Pyx_TraceLine(700,0,__PYX_ERR(0, 700, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_truncations); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_truncations, __pyx_t_3) < 0) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":701
 *             terminations=self._terminations,
 *             truncations=self.truncations,
 *             episode_terminals=self._episode_terminals,             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __Pyx_TraceLine(701,0,__PYX_ERR(0, 701, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_episode_terminals_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_episode_terminals, __pyx_t_3) < 0) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":693
 * 
 *         """
 *         self._episodes = _to_episodes(             # <<<<<<<<<<<<<<
 *             observation_shape=self.get_observation_shape(),
 *             action_size=self.get_action_size(),
 */
  __Pyx_TraceLine(693,0,__PYX_ERR(0, 693, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_episodes, __pyx_t_3) < 0) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":686
 *         return dataset
 * 
 *     def build_episodes(self):             # <<<<<<<<<<<<<<
 *         """ Builds episode objects.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.build_episodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":704
 *         )
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_53__len__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_53__len__ = {"__len__", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_53__len__, METH_O, 0};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_53__len__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_52__len__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_52__len__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__55)
  __Pyx_RefNannySetupContext("__len__", 0);
  __Pyx_TraceCall("__len__", __pyx_f[0], 704, 0, __PYX_ERR(0, 704, __pyx_L1_error));

  /* "minari/dataset.pyx":705
 * 
 *     def __len__(self):
 *         return self.size()             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, index):
 */
  __Pyx_TraceLine(705,0,__PYX_ERR(0, 705, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":704
 *         )
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":707
 *         return self.size()
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         return self.episodes[index]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_55__getitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_55__getitem__ = {"__getitem__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6minari_7dataset_13MinariDataset_55__getitem__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_55__getitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_index = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_index,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, 1); __PYX_ERR(0, 707, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__getitem__") < 0)) __PYX_ERR(0, 707, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_index = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 707, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("minari.dataset.MinariDataset.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_54__getitem__(__pyx_self, __pyx_v_self, __pyx_v_index);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_54__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__56)
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 707, 0, __PYX_ERR(0, 707, __pyx_L1_error));

  /* "minari/dataset.pyx":708
 * 
 *     def __getitem__(self, index):
 *         return self.episodes[index]             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_TraceLine(708,0,__PYX_ERR(0, 708, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_episodes_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":707
 *         return self.size()
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         return self.episodes[index]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":710
 *         return self.episodes[index]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.episodes)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_57__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_13MinariDataset_57__iter__ = {"__iter__", (PyCFunction)__pyx_pw_6minari_7dataset_13MinariDataset_57__iter__, METH_O, 0};
static PyObject *__pyx_pw_6minari_7dataset_13MinariDataset_57__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_13MinariDataset_56__iter__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_13MinariDataset_56__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__57)
  __Pyx_RefNannySetupContext("__iter__", 0);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 710, 0, __PYX_ERR(0, 710, __pyx_L1_error));

  /* "minari/dataset.pyx":711
 * 
 *     def __iter__(self):
 *         return iter(self.episodes)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_TraceLine(711,0,__PYX_ERR(0, 711, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_episodes_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":710
 *         return self.episodes[index]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.episodes)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("minari.dataset.MinariDataset.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":746
 * 
 *     """
 *     def __init__(             # <<<<<<<<<<<<<<
 *         self,
 *         observation_shape,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_7Episode_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_7Episode_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6minari_7dataset_7Episode_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6minari_7dataset_7Episode_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_observation_shape = 0;
  PyObject *__pyx_v_action_size = 0;
  PyObject *__pyx_v_observations = 0;
  PyObject *__pyx_v_actions = 0;
  PyObject *__pyx_v_rewards = 0;
  PyObject *__pyx_v_termination = 0;
  PyObject *__pyx_v_truncation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_observation_shape,&__pyx_n_s_action_size,&__pyx_n_s_observations,&__pyx_n_s_actions,&__pyx_n_s_rewards,&__pyx_n_s_termination,&__pyx_n_s_truncation,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};

    /* "minari/dataset.pyx":753
 *         actions,
 *         rewards,
 *         termination=True,             # <<<<<<<<<<<<<<
 *         truncation=True,
 *     ):
 */
    values[6] = ((PyObject *)((PyObject *)Py_True));

    /* "minari/dataset.pyx":754
 *         rewards,
 *         termination=True,
 *         truncation=True,             # <<<<<<<<<<<<<<
 *     ):
 *         # validation
 */
    values[7] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_observation_shape)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 8, 1); __PYX_ERR(0, 746, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_action_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 8, 2); __PYX_ERR(0, 746, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_observations)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 8, 3); __PYX_ERR(0, 746, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_actions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 8, 4); __PYX_ERR(0, 746, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rewards)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 8, 5); __PYX_ERR(0, 746, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_termination);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_truncation);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 746, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_observation_shape = values[1];
    __pyx_v_action_size = values[2];
    __pyx_v_observations = values[3];
    __pyx_v_actions = values[4];
    __pyx_v_rewards = values[5];
    __pyx_v_termination = values[6];
    __pyx_v_truncation = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 746, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("minari.dataset.Episode.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6minari_7dataset_7Episode___init__(__pyx_self, __pyx_v_self, __pyx_v_observation_shape, __pyx_v_action_size, __pyx_v_observations, __pyx_v_actions, __pyx_v_rewards, __pyx_v_termination, __pyx_v_truncation);

  /* "minari/dataset.pyx":746
 * 
 *     """
 *     def __init__(             # <<<<<<<<<<<<<<
 *         self,
 *         observation_shape,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_7Episode___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_observation_shape, PyObject *__pyx_v_action_size, PyObject *__pyx_v_observations, PyObject *__pyx_v_actions, PyObject *__pyx_v_rewards, PyObject *__pyx_v_termination, PyObject *__pyx_v_truncation) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__58)
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceCall("__init__", __pyx_f[0], 746, 0, __PYX_ERR(0, 746, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_observations);
  __Pyx_INCREF(__pyx_v_actions);

  /* "minari/dataset.pyx":757
 *     ):
 *         # validation
 *         assert isinstance(observations, np.ndarray),\             # <<<<<<<<<<<<<<
 *             'Observation must be numpy array.'
 *         if len(observation_shape) == 3:
 */
  __Pyx_TraceLine(757,0,__PYX_ERR(0, 757, __pyx_L1_error))
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_observations, __pyx_ptype_5numpy_ndarray); 
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Observation_must_be_numpy_array);
      __PYX_ERR(0, 757, __pyx_L1_error)
    }
  }
  #endif

  /* "minari/dataset.pyx":759
 *         assert isinstance(observations, np.ndarray),\
 *             'Observation must be numpy array.'
 *         if len(observation_shape) == 3:             # <<<<<<<<<<<<<<
 *             assert observations.dtype == np.uint8,\
 *                 'Image observation must be uint8 array.'
 */
  __Pyx_TraceLine(759,0,__PYX_ERR(0, 759, __pyx_L1_error))
  __pyx_t_2 = PyObject_Length(__pyx_v_observation_shape); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 759, __pyx_L1_error)
  __pyx_t_1 = ((__pyx_t_2 == 3) != 0);
  if (__pyx_t_1) {

    /* "minari/dataset.pyx":760
 *             'Observation must be numpy array.'
 *         if len(observation_shape) == 3:
 *             assert observations.dtype == np.uint8,\             # <<<<<<<<<<<<<<
 *                 'Image observation must be uint8 array.'
 *         else:
 */
    __Pyx_TraceLine(760,0,__PYX_ERR(0, 760, __pyx_L1_error))
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_observations, __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 760, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 760, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 760, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 760, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 760, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Image_observation_must_be_uint8);
        __PYX_ERR(0, 760, __pyx_L1_error)
      }
    }
    #endif

    /* "minari/dataset.pyx":759
 *         assert isinstance(observations, np.ndarray),\
 *             'Observation must be numpy array.'
 *         if len(observation_shape) == 3:             # <<<<<<<<<<<<<<
 *             assert observations.dtype == np.uint8,\
 *                 'Image observation must be uint8 array.'
 */
    goto __pyx_L3;
  }

  /* "minari/dataset.pyx":763
 *                 'Image observation must be uint8 array.'
 *         else:
 *             if observations.dtype != np.float32:             # <<<<<<<<<<<<<<
 *                 observations = np.asarray(observations, dtype=np.float32)
 * 
 */
  __Pyx_TraceLine(763,0,__PYX_ERR(0, 763, __pyx_L1_error))
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_observations, __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 763, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 763, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_1) {

      /* "minari/dataset.pyx":764
 *         else:
 *             if observations.dtype != np.float32:
 *                 observations = np.asarray(observations, dtype=np.float32)             # <<<<<<<<<<<<<<
 * 
 *         # fix action dtype and shape
 */
      __Pyx_TraceLine(764,0,__PYX_ERR(0, 764, __pyx_L1_error))
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_observations);
      __Pyx_GIVEREF(__pyx_v_observations);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_observations);
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float32); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 764, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_observations, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "minari/dataset.pyx":763
 *                 'Image observation must be uint8 array.'
 *         else:
 *             if observations.dtype != np.float32:             # <<<<<<<<<<<<<<
 *                 observations = np.asarray(observations, dtype=np.float32)
 * 
 */
    }
  }
  __pyx_L3:;

  /* "minari/dataset.pyx":767
 * 
 *         # fix action dtype and shape
 *         if len(actions.shape) == 1:             # <<<<<<<<<<<<<<
 *             actions = np.asarray(actions, dtype=np.int32).reshape(-1)
 *         else:
 */
  __Pyx_TraceLine(767,0,__PYX_ERR(0, 767, __pyx_L1_error))
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_actions, __pyx_n_s_shape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 767, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_1 = ((__pyx_t_2 == 1) != 0);
  if (__pyx_t_1) {

    /* "minari/dataset.pyx":768
 *         # fix action dtype and shape
 *         if len(actions.shape) == 1:
 *             actions = np.asarray(actions, dtype=np.int32).reshape(-1)             # <<<<<<<<<<<<<<
 *         else:
 *             actions = np.asarray(actions, dtype=np.float32)
 */
    __Pyx_TraceLine(768,0,__PYX_ERR(0, 768, __pyx_L1_error))
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_actions);
    __Pyx_GIVEREF(__pyx_v_actions);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_actions);
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int32); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 768, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_reshape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_7 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_8, __pyx_int_neg_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_neg_1);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_actions, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "minari/dataset.pyx":767
 * 
 *         # fix action dtype and shape
 *         if len(actions.shape) == 1:             # <<<<<<<<<<<<<<
 *             actions = np.asarray(actions, dtype=np.int32).reshape(-1)
 *         else:
 */
    goto __pyx_L5;
  }

  /* "minari/dataset.pyx":770
 *             actions = np.asarray(actions, dtype=np.int32).reshape(-1)
 *         else:
 *             actions = np.asarray(actions, dtype=np.float32)             # <<<<<<<<<<<<<<
 * 
 *         self.observation_shape = observation_shape
 */
  __Pyx_TraceLine(770,0,__PYX_ERR(0, 770, __pyx_L1_error))
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_actions);
    __Pyx_GIVEREF(__pyx_v_actions);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_actions);
    __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 770, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF_SET(__pyx_v_actions, __pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L5:;

  /* "minari/dataset.pyx":772
 *             actions = np.asarray(actions, dtype=np.float32)
 * 
 *         self.observation_shape = observation_shape             # <<<<<<<<<<<<<<
 *         self.action_size = action_size
 *         self._observations = observations
 */
  __Pyx_TraceLine(772,0,__PYX_ERR(0, 772, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_observation_shape, __pyx_v_observation_shape) < 0) __PYX_ERR(0, 772, __pyx_L1_error)

  /* "minari/dataset.pyx":773
 * 
 *         self.observation_shape = observation_shape
 *         self.action_size = action_size             # <<<<<<<<<<<<<<
 *         self._observations = observations
 *         self._actions = actions
 */
  __Pyx_TraceLine(773,0,__PYX_ERR(0, 773, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_action_size, __pyx_v_action_size) < 0) __PYX_ERR(0, 773, __pyx_L1_error)

  /* "minari/dataset.pyx":774
 *         self.observation_shape = observation_shape
 *         self.action_size = action_size
 *         self._observations = observations             # <<<<<<<<<<<<<<
 *         self._actions = actions
 *         self._rewards = np.asarray(rewards, dtype=np.float32)
 */
  __Pyx_TraceLine(774,0,__PYX_ERR(0, 774, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_observations_2, __pyx_v_observations) < 0) __PYX_ERR(0, 774, __pyx_L1_error)

  /* "minari/dataset.pyx":775
 *         self.action_size = action_size
 *         self._observations = observations
 *         self._actions = actions             # <<<<<<<<<<<<<<
 *         self._rewards = np.asarray(rewards, dtype=np.float32)
 *         self._termination = termination
 */
  __Pyx_TraceLine(775,0,__PYX_ERR(0, 775, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_actions_2, __pyx_v_actions) < 0) __PYX_ERR(0, 775, __pyx_L1_error)

  /* "minari/dataset.pyx":776
 *         self._observations = observations
 *         self._actions = actions
 *         self._rewards = np.asarray(rewards, dtype=np.float32)             # <<<<<<<<<<<<<<
 *         self._termination = termination
 *         self._truncation = truncation
 */
  __Pyx_TraceLine(776,0,__PYX_ERR(0, 776, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_rewards);
  __Pyx_GIVEREF(__pyx_v_rewards);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_rewards);
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_rewards_2, __pyx_t_4) < 0) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "minari/dataset.pyx":777
 *         self._actions = actions
 *         self._rewards = np.asarray(rewards, dtype=np.float32)
 *         self._termination = termination             # <<<<<<<<<<<<<<
 *         self._truncation = truncation
 *         self._transitions = None
 */
  __Pyx_TraceLine(777,0,__PYX_ERR(0, 777, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_termination_2, __pyx_v_termination) < 0) __PYX_ERR(0, 777, __pyx_L1_error)

  /* "minari/dataset.pyx":778
 *         self._rewards = np.asarray(rewards, dtype=np.float32)
 *         self._termination = termination
 *         self._truncation = truncation             # <<<<<<<<<<<<<<
 *         self._transitions = None
 * 
 */
  __Pyx_TraceLine(778,0,__PYX_ERR(0, 778, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_truncation_2, __pyx_v_truncation) < 0) __PYX_ERR(0, 778, __pyx_L1_error)

  /* "minari/dataset.pyx":779
 *         self._termination = termination
 *         self._truncation = truncation
 *         self._transitions = None             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(779,0,__PYX_ERR(0, 779, __pyx_L1_error))
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_transitions, Py_None) < 0) __PYX_ERR(0, 779, __pyx_L1_error)

  /* "minari/dataset.pyx":746
 * 
 *     """
 *     def __init__(             # <<<<<<<<<<<<<<
 *         self,
 *         observation_shape,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("minari.dataset.Episode.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_observations);
  __Pyx_XDECREF(__pyx_v_actions);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":782
 * 
 *     @property
 *     def observations(self):             # <<<<<<<<<<<<<<
 *         """ Returns the observations.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_7Episode_3observations(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_7Episode_2observations[] = " Returns the observations.\n\n        Returns:\n            numpy.ndarray: array of observations.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_7Episode_3observations = {"observations", (PyCFunction)__pyx_pw_6minari_7dataset_7Episode_3observations, METH_O, __pyx_doc_6minari_7dataset_7Episode_2observations};
static PyObject *__pyx_pw_6minari_7dataset_7Episode_3observations(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("observations (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_7Episode_2observations(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_7Episode_2observations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__59)
  __Pyx_RefNannySetupContext("observations", 0);
  __Pyx_TraceCall("observations", __pyx_f[0], 782, 0, __PYX_ERR(0, 782, __pyx_L1_error));

  /* "minari/dataset.pyx":789
 * 
 *         """
 *         return self._observations             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(789,0,__PYX_ERR(0, 789, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_observations_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":782
 * 
 *     @property
 *     def observations(self):             # <<<<<<<<<<<<<<
 *         """ Returns the observations.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.Episode.observations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":792
 * 
 *     @property
 *     def actions(self):             # <<<<<<<<<<<<<<
 *         """ Returns the actions.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_7Episode_5actions(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_7Episode_4actions[] = " Returns the actions.\n\n        Returns:\n            numpy.ndarray: array of actions.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_7Episode_5actions = {"actions", (PyCFunction)__pyx_pw_6minari_7dataset_7Episode_5actions, METH_O, __pyx_doc_6minari_7dataset_7Episode_4actions};
static PyObject *__pyx_pw_6minari_7dataset_7Episode_5actions(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("actions (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_7Episode_4actions(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_7Episode_4actions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__60)
  __Pyx_RefNannySetupContext("actions", 0);
  __Pyx_TraceCall("actions", __pyx_f[0], 792, 0, __PYX_ERR(0, 792, __pyx_L1_error));

  /* "minari/dataset.pyx":799
 * 
 *         """
 *         return self._actions             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(799,0,__PYX_ERR(0, 799, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_actions_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":792
 * 
 *     @property
 *     def actions(self):             # <<<<<<<<<<<<<<
 *         """ Returns the actions.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.Episode.actions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":802
 * 
 *     @property
 *     def rewards(self):             # <<<<<<<<<<<<<<
 *         """ Returns the rewards.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_7Episode_7rewards(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_7Episode_6rewards[] = " Returns the rewards.\n\n        Returns:\n            numpy.ndarray: array of rewards.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_7Episode_7rewards = {"rewards", (PyCFunction)__pyx_pw_6minari_7dataset_7Episode_7rewards, METH_O, __pyx_doc_6minari_7dataset_7Episode_6rewards};
static PyObject *__pyx_pw_6minari_7dataset_7Episode_7rewards(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rewards (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_7Episode_6rewards(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_7Episode_6rewards(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__61)
  __Pyx_RefNannySetupContext("rewards", 0);
  __Pyx_TraceCall("rewards", __pyx_f[0], 802, 0, __PYX_ERR(0, 802, __pyx_L1_error));

  /* "minari/dataset.pyx":809
 * 
 *         """
 *         return self._rewards             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(809,0,__PYX_ERR(0, 809, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rewards_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":802
 * 
 *     @property
 *     def rewards(self):             # <<<<<<<<<<<<<<
 *         """ Returns the rewards.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.Episode.rewards", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":812
 * 
 *     @property
 *     def termination(self):             # <<<<<<<<<<<<<<
 *         """ Returns the termination flag.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_7Episode_9termination(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_7Episode_8termination[] = " Returns the termination flag.\n\n        Returns:\n            bool: the terminal flag.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_7Episode_9termination = {"termination", (PyCFunction)__pyx_pw_6minari_7dataset_7Episode_9termination, METH_O, __pyx_doc_6minari_7dataset_7Episode_8termination};
static PyObject *__pyx_pw_6minari_7dataset_7Episode_9termination(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("termination (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_7Episode_8termination(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_7Episode_8termination(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__62)
  __Pyx_RefNannySetupContext("termination", 0);
  __Pyx_TraceCall("termination", __pyx_f[0], 812, 0, __PYX_ERR(0, 812, __pyx_L1_error));

  /* "minari/dataset.pyx":819
 * 
 *         """
 *         return self._termination             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(819,0,__PYX_ERR(0, 819, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_termination_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":812
 * 
 *     @property
 *     def termination(self):             # <<<<<<<<<<<<<<
 *         """ Returns the termination flag.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.Episode.termination", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":822
 * 
 *     @property
 *     def truncation(self):             # <<<<<<<<<<<<<<
 *         """ Returns the truncation flag.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_7Episode_11truncation(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_7Episode_10truncation[] = " Returns the truncation flag.\n\n        Returns:\n            bool: the terminal flag.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_7Episode_11truncation = {"truncation", (PyCFunction)__pyx_pw_6minari_7dataset_7Episode_11truncation, METH_O, __pyx_doc_6minari_7dataset_7Episode_10truncation};
static PyObject *__pyx_pw_6minari_7dataset_7Episode_11truncation(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("truncation (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_7Episode_10truncation(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_7Episode_10truncation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__63)
  __Pyx_RefNannySetupContext("truncation", 0);
  __Pyx_TraceCall("truncation", __pyx_f[0], 822, 0, __PYX_ERR(0, 822, __pyx_L1_error));

  /* "minari/dataset.pyx":829
 * 
 *         """
 *         return self._truncation             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(829,0,__PYX_ERR(0, 829, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_truncation_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 829, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":822
 * 
 *     @property
 *     def truncation(self):             # <<<<<<<<<<<<<<
 *         """ Returns the truncation flag.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.Episode.truncation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":832
 * 
 *     @property
 *     def transitions(self):             # <<<<<<<<<<<<<<
 *         """ Returns the transitions.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_7Episode_13transitions(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_7Episode_12transitions[] = " Returns the transitions.\n\n        Returns:\n            list(minari.dataset.Transition):\n                list of :class:`minari.dataset.Transition` objects.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_7Episode_13transitions = {"transitions", (PyCFunction)__pyx_pw_6minari_7dataset_7Episode_13transitions, METH_O, __pyx_doc_6minari_7dataset_7Episode_12transitions};
static PyObject *__pyx_pw_6minari_7dataset_7Episode_13transitions(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("transitions (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_7Episode_12transitions(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_7Episode_12transitions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__64)
  __Pyx_RefNannySetupContext("transitions", 0);
  __Pyx_TraceCall("transitions", __pyx_f[0], 832, 0, __PYX_ERR(0, 832, __pyx_L1_error));

  /* "minari/dataset.pyx":840
 * 
 *         """
 *         if self._transitions is None:             # <<<<<<<<<<<<<<
 *             self.build_transitions()
 *         return self._transitions
 */
  __Pyx_TraceLine(840,0,__PYX_ERR(0, 840, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transitions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "minari/dataset.pyx":841
 *         """
 *         if self._transitions is None:
 *             self.build_transitions()             # <<<<<<<<<<<<<<
 *         return self._transitions
 * 
 */
    __Pyx_TraceLine(841,0,__PYX_ERR(0, 841, __pyx_L1_error))
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_build_transitions); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "minari/dataset.pyx":840
 * 
 *         """
 *         if self._transitions is None:             # <<<<<<<<<<<<<<
 *             self.build_transitions()
 *         return self._transitions
 */
  }

  /* "minari/dataset.pyx":842
 *         if self._transitions is None:
 *             self.build_transitions()
 *         return self._transitions             # <<<<<<<<<<<<<<
 * 
 *     def build_transitions(self):
 */
  __Pyx_TraceLine(842,0,__PYX_ERR(0, 842, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transitions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":832
 * 
 *     @property
 *     def transitions(self):             # <<<<<<<<<<<<<<
 *         """ Returns the transitions.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("minari.dataset.Episode.transitions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":844
 *         return self._transitions
 * 
 *     def build_transitions(self):             # <<<<<<<<<<<<<<
 *         """ Builds transition objects.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_7Episode_15build_transitions(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_7Episode_14build_transitions[] = " Builds transition objects.\n\n        This method will be internally called when accessing the transitions\n        property at the first time.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_7Episode_15build_transitions = {"build_transitions", (PyCFunction)__pyx_pw_6minari_7dataset_7Episode_15build_transitions, METH_O, __pyx_doc_6minari_7dataset_7Episode_14build_transitions};
static PyObject *__pyx_pw_6minari_7dataset_7Episode_15build_transitions(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("build_transitions (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_7Episode_14build_transitions(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_7Episode_14build_transitions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__65)
  __Pyx_RefNannySetupContext("build_transitions", 0);
  __Pyx_TraceCall("build_transitions", __pyx_f[0], 844, 0, __PYX_ERR(0, 844, __pyx_L1_error));

  /* "minari/dataset.pyx":851
 * 
 *         """
 *         self._transitions = _to_transitions(             # <<<<<<<<<<<<<<
 *             observation_shape=self.observation_shape,
 *             action_size=self.action_size,
 */
  __Pyx_TraceLine(851,0,__PYX_ERR(0, 851, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_to_transitions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "minari/dataset.pyx":852
 *         """
 *         self._transitions = _to_transitions(
 *             observation_shape=self.observation_shape,             # <<<<<<<<<<<<<<
 *             action_size=self.action_size,
 *             observations=self._observations,
 */
  __Pyx_TraceLine(852,0,__PYX_ERR(0, 852, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_observation_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_observation_shape, __pyx_t_3) < 0) __PYX_ERR(0, 852, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":853
 *         self._transitions = _to_transitions(
 *             observation_shape=self.observation_shape,
 *             action_size=self.action_size,             # <<<<<<<<<<<<<<
 *             observations=self._observations,
 *             actions=self._actions,
 */
  __Pyx_TraceLine(853,0,__PYX_ERR(0, 853, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_action_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 853, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_action_size, __pyx_t_3) < 0) __PYX_ERR(0, 852, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":854
 *             observation_shape=self.observation_shape,
 *             action_size=self.action_size,
 *             observations=self._observations,             # <<<<<<<<<<<<<<
 *             actions=self._actions,
 *             rewards=self._rewards,
 */
  __Pyx_TraceLine(854,0,__PYX_ERR(0, 854, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_observations_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_observations, __pyx_t_3) < 0) __PYX_ERR(0, 852, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":855
 *             action_size=self.action_size,
 *             observations=self._observations,
 *             actions=self._actions,             # <<<<<<<<<<<<<<
 *             rewards=self._rewards,
 *             termination=self._termination,
 */
  __Pyx_TraceLine(855,0,__PYX_ERR(0, 855, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_actions_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 855, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_actions, __pyx_t_3) < 0) __PYX_ERR(0, 852, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":856
 *             observations=self._observations,
 *             actions=self._actions,
 *             rewards=self._rewards,             # <<<<<<<<<<<<<<
 *             termination=self._termination,
 *             truncation=self._truncation,
 */
  __Pyx_TraceLine(856,0,__PYX_ERR(0, 856, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rewards_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_rewards, __pyx_t_3) < 0) __PYX_ERR(0, 852, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":857
 *             actions=self._actions,
 *             rewards=self._rewards,
 *             termination=self._termination,             # <<<<<<<<<<<<<<
 *             truncation=self._truncation,
 *         )
 */
  __Pyx_TraceLine(857,0,__PYX_ERR(0, 857, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_termination_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_termination, __pyx_t_3) < 0) __PYX_ERR(0, 852, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":858
 *             rewards=self._rewards,
 *             termination=self._termination,
 *             truncation=self._truncation,             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __Pyx_TraceLine(858,0,__PYX_ERR(0, 858, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_truncation_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 858, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_truncation, __pyx_t_3) < 0) __PYX_ERR(0, 852, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":851
 * 
 *         """
 *         self._transitions = _to_transitions(             # <<<<<<<<<<<<<<
 *             observation_shape=self.observation_shape,
 *             action_size=self.action_size,
 */
  __Pyx_TraceLine(851,0,__PYX_ERR(0, 851, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_transitions, __pyx_t_3) < 0) __PYX_ERR(0, 851, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":844
 *         return self._transitions
 * 
 *     def build_transitions(self):             # <<<<<<<<<<<<<<
 *         """ Builds transition objects.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("minari.dataset.Episode.build_transitions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":861
 *         )
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         """ Returns the number of transitions.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_7Episode_17size(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_7Episode_16size[] = " Returns the number of transitions.\n\n        Returns:\n            int: the number of transitions.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_7Episode_17size = {"size", (PyCFunction)__pyx_pw_6minari_7dataset_7Episode_17size, METH_O, __pyx_doc_6minari_7dataset_7Episode_16size};
static PyObject *__pyx_pw_6minari_7dataset_7Episode_17size(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("size (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_7Episode_16size(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_7Episode_16size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__66)
  __Pyx_RefNannySetupContext("size", 0);
  __Pyx_TraceCall("size", __pyx_f[0], 861, 0, __PYX_ERR(0, 861, __pyx_L1_error));

  /* "minari/dataset.pyx":868
 * 
 *         """
 *         return len(self.transitions)             # <<<<<<<<<<<<<<
 * 
 *     def get_observation_shape(self):
 */
  __Pyx_TraceLine(868,0,__PYX_ERR(0, 868, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transitions_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 868, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":861
 *         )
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         """ Returns the number of transitions.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.Episode.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":870
 *         return len(self.transitions)
 * 
 *     def get_observation_shape(self):             # <<<<<<<<<<<<<<
 *         """ Returns observation shape.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_7Episode_19get_observation_shape(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_7Episode_18get_observation_shape[] = " Returns observation shape.\n\n        Returns:\n            tuple: observation shape.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_7Episode_19get_observation_shape = {"get_observation_shape", (PyCFunction)__pyx_pw_6minari_7dataset_7Episode_19get_observation_shape, METH_O, __pyx_doc_6minari_7dataset_7Episode_18get_observation_shape};
static PyObject *__pyx_pw_6minari_7dataset_7Episode_19get_observation_shape(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_observation_shape (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_7Episode_18get_observation_shape(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_7Episode_18get_observation_shape(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__67)
  __Pyx_RefNannySetupContext("get_observation_shape", 0);
  __Pyx_TraceCall("get_observation_shape", __pyx_f[0], 870, 0, __PYX_ERR(0, 870, __pyx_L1_error));

  /* "minari/dataset.pyx":877
 * 
 *         """
 *         return self.observation_shape             # <<<<<<<<<<<<<<
 * 
 *     def get_action_size(self):
 */
  __Pyx_TraceLine(877,0,__PYX_ERR(0, 877, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_observation_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":870
 *         return len(self.transitions)
 * 
 *     def get_observation_shape(self):             # <<<<<<<<<<<<<<
 *         """ Returns observation shape.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.Episode.get_observation_shape", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":879
 *         return self.observation_shape
 * 
 *     def get_action_size(self):             # <<<<<<<<<<<<<<
 *         """ Returns dimension of action-space.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_7Episode_21get_action_size(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_7Episode_20get_action_size[] = " Returns dimension of action-space.\n\n        Returns:\n            int: dimension of action-space.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_7Episode_21get_action_size = {"get_action_size", (PyCFunction)__pyx_pw_6minari_7dataset_7Episode_21get_action_size, METH_O, __pyx_doc_6minari_7dataset_7Episode_20get_action_size};
static PyObject *__pyx_pw_6minari_7dataset_7Episode_21get_action_size(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_action_size (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_7Episode_20get_action_size(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_7Episode_20get_action_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__68)
  __Pyx_RefNannySetupContext("get_action_size", 0);
  __Pyx_TraceCall("get_action_size", __pyx_f[0], 879, 0, __PYX_ERR(0, 879, __pyx_L1_error));

  /* "minari/dataset.pyx":886
 * 
 *         """
 *         return self.action_size             # <<<<<<<<<<<<<<
 * 
 *     def compute_return(self):
 */
  __Pyx_TraceLine(886,0,__PYX_ERR(0, 886, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_action_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":879
 *         return self.observation_shape
 * 
 *     def get_action_size(self):             # <<<<<<<<<<<<<<
 *         """ Returns dimension of action-space.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.Episode.get_action_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":888
 *         return self.action_size
 * 
 *     def compute_return(self):             # <<<<<<<<<<<<<<
 *         """ Computes sum of rewards.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_7Episode_23compute_return(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6minari_7dataset_7Episode_22compute_return[] = " Computes sum of rewards.\n\n        .. math::\n\n            R = \\sum_{i=1} r_i\n\n        Returns:\n            float: episode return.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_7Episode_23compute_return = {"compute_return", (PyCFunction)__pyx_pw_6minari_7dataset_7Episode_23compute_return, METH_O, __pyx_doc_6minari_7dataset_7Episode_22compute_return};
static PyObject *__pyx_pw_6minari_7dataset_7Episode_23compute_return(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("compute_return (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_7Episode_22compute_return(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_7Episode_22compute_return(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__69)
  __Pyx_RefNannySetupContext("compute_return", 0);
  __Pyx_TraceCall("compute_return", __pyx_f[0], 888, 0, __PYX_ERR(0, 888, __pyx_L1_error));

  /* "minari/dataset.pyx":899
 * 
 *         """
 *         return np.sum(self._rewards)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_TraceLine(899,0,__PYX_ERR(0, 899, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rewards_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":888
 *         return self.action_size
 * 
 *     def compute_return(self):             # <<<<<<<<<<<<<<
 *         """ Computes sum of rewards.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("minari.dataset.Episode.compute_return", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":901
 *         return np.sum(self._rewards)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_7Episode_25__len__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_7Episode_25__len__ = {"__len__", (PyCFunction)__pyx_pw_6minari_7dataset_7Episode_25__len__, METH_O, 0};
static PyObject *__pyx_pw_6minari_7dataset_7Episode_25__len__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_7Episode_24__len__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_7Episode_24__len__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__70)
  __Pyx_RefNannySetupContext("__len__", 0);
  __Pyx_TraceCall("__len__", __pyx_f[0], 901, 0, __PYX_ERR(0, 901, __pyx_L1_error));

  /* "minari/dataset.pyx":902
 * 
 *     def __len__(self):
 *         return self.size()             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, index):
 */
  __Pyx_TraceLine(902,0,__PYX_ERR(0, 902, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":901
 *         return np.sum(self._rewards)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("minari.dataset.Episode.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":904
 *         return self.size()
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         return self.transitions[index]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_7Episode_27__getitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_7Episode_27__getitem__ = {"__getitem__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6minari_7dataset_7Episode_27__getitem__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6minari_7dataset_7Episode_27__getitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_index = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_index,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, 1); __PYX_ERR(0, 904, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__getitem__") < 0)) __PYX_ERR(0, 904, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_index = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 904, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("minari.dataset.Episode.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6minari_7dataset_7Episode_26__getitem__(__pyx_self, __pyx_v_self, __pyx_v_index);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_7Episode_26__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__71)
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 904, 0, __PYX_ERR(0, 904, __pyx_L1_error));

  /* "minari/dataset.pyx":905
 * 
 *     def __getitem__(self, index):
 *         return self.transitions[index]             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_TraceLine(905,0,__PYX_ERR(0, 905, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transitions_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":904
 *         return self.size()
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         return self.transitions[index]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("minari.dataset.Episode.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":907
 *         return self.transitions[index]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.transitions)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_7Episode_29__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_7Episode_29__iter__ = {"__iter__", (PyCFunction)__pyx_pw_6minari_7dataset_7Episode_29__iter__, METH_O, 0};
static PyObject *__pyx_pw_6minari_7dataset_7Episode_29__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_7Episode_28__iter__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_7Episode_28__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__72)
  __Pyx_RefNannySetupContext("__iter__", 0);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 907, 0, __PYX_ERR(0, 907, __pyx_L1_error));

  /* "minari/dataset.pyx":908
 * 
 *     def __iter__(self):
 *         return iter(self.transitions)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_TraceLine(908,0,__PYX_ERR(0, 908, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transitions_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":907
 *         return self.transitions[index]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.transitions)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("minari.dataset.Episode.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":946
 *     cdef Transition _next_transition
 * 
 *     def __cinit__(             # <<<<<<<<<<<<<<
 *         self,
 *         vector[int] observation_shape,
 */

/* Python wrapper */
static int __pyx_pw_6minari_7dataset_10Transition_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6minari_7dataset_10Transition_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  std::vector<int>  __pyx_v_observation_shape;
  int __pyx_v_action_size;
  PyArrayObject *__pyx_v_observation = 0;
  PyObject *__pyx_v_action = 0;
  float __pyx_v_reward;
  PyArrayObject *__pyx_v_next_observation = 0;
  float __pyx_v_termination;
  float __pyx_v_truncation;
  struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_prev_transition = 0;
  struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_next_transition = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_observation_shape,&__pyx_n_s_action_size,&__pyx_n_s_observation,&__pyx_n_s_action,&__pyx_n_s_reward,&__pyx_n_s_next_observation,&__pyx_n_s_termination,&__pyx_n_s_truncation,&__pyx_n_s_prev_transition,&__pyx_n_s_next_transition,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};

    /* "minari/dataset.pyx":956
 *         float termination,
 *         float truncation,
 *         Transition prev_transition=None,             # <<<<<<<<<<<<<<
 *         Transition next_transition=None
 *     ):
 */
    values[8] = (PyObject *)((struct __pyx_obj_6minari_7dataset_Transition *)Py_None);

    /* "minari/dataset.pyx":957
 *         float truncation,
 *         Transition prev_transition=None,
 *         Transition next_transition=None             # <<<<<<<<<<<<<<
 *     ):
 *         cdef TransitionPtr prev_ptr
 */
    values[9] = (PyObject *)((struct __pyx_obj_6minari_7dataset_Transition *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_observation_shape)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_action_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 8, 10, 1); __PYX_ERR(0, 946, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_observation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 8, 10, 2); __PYX_ERR(0, 946, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_action)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 8, 10, 3); __PYX_ERR(0, 946, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reward)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 8, 10, 4); __PYX_ERR(0, 946, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next_observation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 8, 10, 5); __PYX_ERR(0, 946, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_termination)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 8, 10, 6); __PYX_ERR(0, 946, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_truncation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 8, 10, 7); __PYX_ERR(0, 946, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prev_transition);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next_transition);
          if (value) { values[9] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 946, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_observation_shape = __pyx_convert_vector_from_py_int(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 948, __pyx_L3_error)
    __pyx_v_action_size = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_action_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 949, __pyx_L3_error)
    __pyx_v_observation = ((PyArrayObject *)values[2]);
    __pyx_v_action = values[3];
    __pyx_v_reward = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_reward == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 952, __pyx_L3_error)
    __pyx_v_next_observation = ((PyArrayObject *)values[5]);
    __pyx_v_termination = __pyx_PyFloat_AsFloat(values[6]); if (unlikely((__pyx_v_termination == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 954, __pyx_L3_error)
    __pyx_v_truncation = __pyx_PyFloat_AsFloat(values[7]); if (unlikely((__pyx_v_truncation == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 955, __pyx_L3_error)
    __pyx_v_prev_transition = ((struct __pyx_obj_6minari_7dataset_Transition *)values[8]);
    __pyx_v_next_transition = ((struct __pyx_obj_6minari_7dataset_Transition *)values[9]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 8, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 946, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("minari.dataset.Transition.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_observation), __pyx_ptype_5numpy_ndarray, 1, "observation", 0))) __PYX_ERR(0, 950, __pyx_L1_error)
  if (unlikely(((PyObject *)__pyx_v_action) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "action"); __PYX_ERR(0, 951, __pyx_L1_error)
  }
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_next_observation), __pyx_ptype_5numpy_ndarray, 1, "next_observation", 0))) __PYX_ERR(0, 953, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_prev_transition), __pyx_ptype_6minari_7dataset_Transition, 1, "prev_transition", 0))) __PYX_ERR(0, 956, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_next_transition), __pyx_ptype_6minari_7dataset_Transition, 1, "next_transition", 0))) __PYX_ERR(0, 957, __pyx_L1_error)
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition___cinit__(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self), __pyx_v_observation_shape, __pyx_v_action_size, __pyx_v_observation, __pyx_v_action, __pyx_v_reward, __pyx_v_next_observation, __pyx_v_termination, __pyx_v_truncation, __pyx_v_prev_transition, __pyx_v_next_transition);

  /* "minari/dataset.pyx":946
 *     cdef Transition _next_transition
 * 
 *     def __cinit__(             # <<<<<<<<<<<<<<
 *         self,
 *         vector[int] observation_shape,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6minari_7dataset_10Transition___cinit__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self, std::vector<int>  __pyx_v_observation_shape, int __pyx_v_action_size, PyArrayObject *__pyx_v_observation, PyObject *__pyx_v_action, float __pyx_v_reward, PyArrayObject *__pyx_v_next_observation, float __pyx_v_termination, float __pyx_v_truncation, struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_prev_transition, struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_next_transition) {
  __pyx_t_6minari_7dataset_TransitionPtr __pyx_v_prev_ptr;
  __pyx_t_6minari_7dataset_TransitionPtr __pyx_v_next_ptr;
  PyArrayObject *__pyx_v_action_f = 0;
  int __pyx_v_action_i;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_action_f;
  __Pyx_Buffer __pyx_pybuffer_action_f;
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  std::shared_ptr<minari::CTransition>  __pyx_t_7;
  int __pyx_t_8;
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_TraceCall("__cinit__", __pyx_f[0], 946, 0, __PYX_ERR(0, 946, __pyx_L1_error));
  __Pyx_INCREF((PyObject *)__pyx_v_observation);
  __Pyx_INCREF((PyObject *)__pyx_v_next_observation);
  __pyx_pybuffer_action_f.pybuffer.buf = NULL;
  __pyx_pybuffer_action_f.refcount = 0;
  __pyx_pybuffernd_action_f.data = NULL;
  __pyx_pybuffernd_action_f.rcbuffer = &__pyx_pybuffer_action_f;

  /* "minari/dataset.pyx":963
 * 
 *         # validation
 *         if observation_shape.size() == 3:             # <<<<<<<<<<<<<<
 *             assert observation.dtype == np.uint8,\
 *                 'Image observation must be uint8 array.'
 */
  __Pyx_TraceLine(963,0,__PYX_ERR(0, 963, __pyx_L1_error))
  __pyx_t_1 = ((__pyx_v_observation_shape.size() == 3) != 0);
  if (__pyx_t_1) {

    /* "minari/dataset.pyx":964
 *         # validation
 *         if observation_shape.size() == 3:
 *             assert observation.dtype == np.uint8,\             # <<<<<<<<<<<<<<
 *                 'Image observation must be uint8 array.'
 *             assert next_observation.dtype == np.uint8,\
 */
    __Pyx_TraceLine(964,0,__PYX_ERR(0, 964, __pyx_L1_error))
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_observation), __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 964, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 964, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 964, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 964, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 964, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Image_observation_must_be_uint8);
        __PYX_ERR(0, 964, __pyx_L1_error)
      }
    }
    #endif

    /* "minari/dataset.pyx":966
 *             assert observation.dtype == np.uint8,\
 *                 'Image observation must be uint8 array.'
 *             assert next_observation.dtype == np.uint8,\             # <<<<<<<<<<<<<<
 *                 'Image observation must be uint8 array.'
 *         else:
 */
    __Pyx_TraceLine(966,0,__PYX_ERR(0, 966, __pyx_L1_error))
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_next_observation), __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 966, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 966, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 966, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 966, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 966, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Image_observation_must_be_uint8);
        __PYX_ERR(0, 966, __pyx_L1_error)
      }
    }
    #endif

    /* "minari/dataset.pyx":963
 * 
 *         # validation
 *         if observation_shape.size() == 3:             # <<<<<<<<<<<<<<
 *             assert observation.dtype == np.uint8,\
 *                 'Image observation must be uint8 array.'
 */
    goto __pyx_L3;
  }

  /* "minari/dataset.pyx":969
 *                 'Image observation must be uint8 array.'
 *         else:
 *             if observation.dtype != np.float32:             # <<<<<<<<<<<<<<
 *                 observation = np.asarray(observation, dtype=np.float32)
 *             if next_observation.dtype != np.float32:
 */
  __Pyx_TraceLine(969,0,__PYX_ERR(0, 969, __pyx_L1_error))
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_observation), __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 969, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 969, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_1) {

      /* "minari/dataset.pyx":970
 *         else:
 *             if observation.dtype != np.float32:
 *                 observation = np.asarray(observation, dtype=np.float32)             # <<<<<<<<<<<<<<
 *             if next_observation.dtype != np.float32:
 *                 next_observation = np.asarray(
 */
      __Pyx_TraceLine(970,0,__PYX_ERR(0, 970, __pyx_L1_error))
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_observation));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_observation));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_observation));
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_DECREF_SET(__pyx_v_observation, ((PyArrayObject *)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "minari/dataset.pyx":969
 *                 'Image observation must be uint8 array.'
 *         else:
 *             if observation.dtype != np.float32:             # <<<<<<<<<<<<<<
 *                 observation = np.asarray(observation, dtype=np.float32)
 *             if next_observation.dtype != np.float32:
 */
    }

    /* "minari/dataset.pyx":971
 *             if observation.dtype != np.float32:
 *                 observation = np.asarray(observation, dtype=np.float32)
 *             if next_observation.dtype != np.float32:             # <<<<<<<<<<<<<<
 *                 next_observation = np.asarray(
 *                     next_observation, dtype=np.float32
 */
    __Pyx_TraceLine(971,0,__PYX_ERR(0, 971, __pyx_L1_error))
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_next_observation), __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 971, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 971, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "minari/dataset.pyx":972
 *                 observation = np.asarray(observation, dtype=np.float32)
 *             if next_observation.dtype != np.float32:
 *                 next_observation = np.asarray(             # <<<<<<<<<<<<<<
 *                     next_observation, dtype=np.float32
 *                 )
 */
      __Pyx_TraceLine(972,0,__PYX_ERR(0, 972, __pyx_L1_error))
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 972, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 972, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "minari/dataset.pyx":973
 *             if next_observation.dtype != np.float32:
 *                 next_observation = np.asarray(
 *                     next_observation, dtype=np.float32             # <<<<<<<<<<<<<<
 *                 )
 * 
 */
      __Pyx_TraceLine(973,0,__PYX_ERR(0, 973, __pyx_L1_error))
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 972, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(((PyObject *)__pyx_v_next_observation));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_next_observation));
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_next_observation));
      __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 973, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 973, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 973, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 973, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "minari/dataset.pyx":972
 *                 observation = np.asarray(observation, dtype=np.float32)
 *             if next_observation.dtype != np.float32:
 *                 next_observation = np.asarray(             # <<<<<<<<<<<<<<
 *                     next_observation, dtype=np.float32
 *                 )
 */
      __Pyx_TraceLine(972,0,__PYX_ERR(0, 972, __pyx_L1_error))
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 972, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 972, __pyx_L1_error)
      __Pyx_DECREF_SET(__pyx_v_next_observation, ((PyArrayObject *)__pyx_t_5));
      __pyx_t_5 = 0;

      /* "minari/dataset.pyx":971
 *             if observation.dtype != np.float32:
 *                 observation = np.asarray(observation, dtype=np.float32)
 *             if next_observation.dtype != np.float32:             # <<<<<<<<<<<<<<
 *                 next_observation = np.asarray(
 *                     next_observation, dtype=np.float32
 */
    }
  }
  __pyx_L3:;

  /* "minari/dataset.pyx":976
 *                 )
 * 
 *         if prev_transition:             # <<<<<<<<<<<<<<
 *             prev_ptr = prev_transition.get_ptr()
 *         if next_transition:
 */
  __Pyx_TraceLine(976,0,__PYX_ERR(0, 976, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_prev_transition)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 976, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "minari/dataset.pyx":977
 * 
 *         if prev_transition:
 *             prev_ptr = prev_transition.get_ptr()             # <<<<<<<<<<<<<<
 *         if next_transition:
 *             next_ptr = next_transition.get_ptr()
 */
    __Pyx_TraceLine(977,0,__PYX_ERR(0, 977, __pyx_L1_error))
    __pyx_v_prev_ptr = ((struct __pyx_vtabstruct_6minari_7dataset_Transition *)__pyx_v_prev_transition->__pyx_vtab)->get_ptr(__pyx_v_prev_transition);

    /* "minari/dataset.pyx":976
 *                 )
 * 
 *         if prev_transition:             # <<<<<<<<<<<<<<
 *             prev_ptr = prev_transition.get_ptr()
 *         if next_transition:
 */
  }

  /* "minari/dataset.pyx":978
 *         if prev_transition:
 *             prev_ptr = prev_transition.get_ptr()
 *         if next_transition:             # <<<<<<<<<<<<<<
 *             next_ptr = next_transition.get_ptr()
 * 
 */
  __Pyx_TraceLine(978,0,__PYX_ERR(0, 978, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_next_transition)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 978, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "minari/dataset.pyx":979
 *             prev_ptr = prev_transition.get_ptr()
 *         if next_transition:
 *             next_ptr = next_transition.get_ptr()             # <<<<<<<<<<<<<<
 * 
 *         self._thisptr = make_shared[CTransition]()
 */
    __Pyx_TraceLine(979,0,__PYX_ERR(0, 979, __pyx_L1_error))
    __pyx_v_next_ptr = ((struct __pyx_vtabstruct_6minari_7dataset_Transition *)__pyx_v_next_transition->__pyx_vtab)->get_ptr(__pyx_v_next_transition);

    /* "minari/dataset.pyx":978
 *         if prev_transition:
 *             prev_ptr = prev_transition.get_ptr()
 *         if next_transition:             # <<<<<<<<<<<<<<
 *             next_ptr = next_transition.get_ptr()
 * 
 */
  }

  /* "minari/dataset.pyx":981
 *             next_ptr = next_transition.get_ptr()
 * 
 *         self._thisptr = make_shared[CTransition]()             # <<<<<<<<<<<<<<
 *         self._thisptr.get().observation_shape = observation_shape
 *         self._thisptr.get().action_size = action_size
 */
  __Pyx_TraceLine(981,0,__PYX_ERR(0, 981, __pyx_L1_error))
  try {
    __pyx_t_7 = std::make_shared<minari::CTransition>();
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(0, 981, __pyx_L1_error)
  }
  __pyx_v_self->_thisptr = __pyx_t_7;

  /* "minari/dataset.pyx":982
 * 
 *         self._thisptr = make_shared[CTransition]()
 *         self._thisptr.get().observation_shape = observation_shape             # <<<<<<<<<<<<<<
 *         self._thisptr.get().action_size = action_size
 *         self._thisptr.get().reward = reward
 */
  __Pyx_TraceLine(982,0,__PYX_ERR(0, 982, __pyx_L1_error))
  __pyx_v_self->_thisptr.get()->observation_shape = __pyx_v_observation_shape;

  /* "minari/dataset.pyx":983
 *         self._thisptr = make_shared[CTransition]()
 *         self._thisptr.get().observation_shape = observation_shape
 *         self._thisptr.get().action_size = action_size             # <<<<<<<<<<<<<<
 *         self._thisptr.get().reward = reward
 *         self._thisptr.get().termination = termination
 */
  __Pyx_TraceLine(983,0,__PYX_ERR(0, 983, __pyx_L1_error))
  __pyx_v_self->_thisptr.get()->action_size = __pyx_v_action_size;

  /* "minari/dataset.pyx":984
 *         self._thisptr.get().observation_shape = observation_shape
 *         self._thisptr.get().action_size = action_size
 *         self._thisptr.get().reward = reward             # <<<<<<<<<<<<<<
 *         self._thisptr.get().termination = termination
 *         self._thisptr.get().truncation = truncation
 */
  __Pyx_TraceLine(984,0,__PYX_ERR(0, 984, __pyx_L1_error))
  __pyx_v_self->_thisptr.get()->reward = __pyx_v_reward;

  /* "minari/dataset.pyx":985
 *         self._thisptr.get().action_size = action_size
 *         self._thisptr.get().reward = reward
 *         self._thisptr.get().termination = termination             # <<<<<<<<<<<<<<
 *         self._thisptr.get().truncation = truncation
 *         self._thisptr.get().prev_transition = prev_ptr
 */
  __Pyx_TraceLine(985,0,__PYX_ERR(0, 985, __pyx_L1_error))
  __pyx_v_self->_thisptr.get()->termination = __pyx_v_termination;

  /* "minari/dataset.pyx":986
 *         self._thisptr.get().reward = reward
 *         self._thisptr.get().termination = termination
 *         self._thisptr.get().truncation = truncation             # <<<<<<<<<<<<<<
 *         self._thisptr.get().prev_transition = prev_ptr
 *         self._thisptr.get().next_transition = next_ptr
 */
  __Pyx_TraceLine(986,0,__PYX_ERR(0, 986, __pyx_L1_error))
  __pyx_v_self->_thisptr.get()->truncation = __pyx_v_truncation;

  /* "minari/dataset.pyx":987
 *         self._thisptr.get().termination = termination
 *         self._thisptr.get().truncation = truncation
 *         self._thisptr.get().prev_transition = prev_ptr             # <<<<<<<<<<<<<<
 *         self._thisptr.get().next_transition = next_ptr
 * 
 */
  __Pyx_TraceLine(987,0,__PYX_ERR(0, 987, __pyx_L1_error))
  __pyx_v_self->_thisptr.get()->prev_transition = __pyx_v_prev_ptr;

  /* "minari/dataset.pyx":988
 *         self._thisptr.get().truncation = truncation
 *         self._thisptr.get().prev_transition = prev_ptr
 *         self._thisptr.get().next_transition = next_ptr             # <<<<<<<<<<<<<<
 * 
 *         # assign observation
 */
  __Pyx_TraceLine(988,0,__PYX_ERR(0, 988, __pyx_L1_error))
  __pyx_v_self->_thisptr.get()->next_transition = __pyx_v_next_ptr;

  /* "minari/dataset.pyx":991
 * 
 *         # assign observation
 *         if observation_shape.size() == 3:             # <<<<<<<<<<<<<<
 *             self._thisptr.get().observation_i = <UINT8_t*> observation.data
 *             self._thisptr.get().next_observation_i = <UINT8_t*> next_observation.data
 */
  __Pyx_TraceLine(991,0,__PYX_ERR(0, 991, __pyx_L1_error))
  __pyx_t_1 = ((__pyx_v_observation_shape.size() == 3) != 0);
  if (__pyx_t_1) {

    /* "minari/dataset.pyx":992
 *         # assign observation
 *         if observation_shape.size() == 3:
 *             self._thisptr.get().observation_i = <UINT8_t*> observation.data             # <<<<<<<<<<<<<<
 *             self._thisptr.get().next_observation_i = <UINT8_t*> next_observation.data
 *             self._is_image = True
 */
    __Pyx_TraceLine(992,0,__PYX_ERR(0, 992, __pyx_L1_error))
    __pyx_v_self->_thisptr.get()->observation_i = ((__pyx_t_6minari_7dataset_UINT8_t *)__pyx_v_observation->data);

    /* "minari/dataset.pyx":993
 *         if observation_shape.size() == 3:
 *             self._thisptr.get().observation_i = <UINT8_t*> observation.data
 *             self._thisptr.get().next_observation_i = <UINT8_t*> next_observation.data             # <<<<<<<<<<<<<<
 *             self._is_image = True
 *         else:
 */
    __Pyx_TraceLine(993,0,__PYX_ERR(0, 993, __pyx_L1_error))
    __pyx_v_self->_thisptr.get()->next_observation_i = ((__pyx_t_6minari_7dataset_UINT8_t *)__pyx_v_next_observation->data);

    /* "minari/dataset.pyx":994
 *             self._thisptr.get().observation_i = <UINT8_t*> observation.data
 *             self._thisptr.get().next_observation_i = <UINT8_t*> next_observation.data
 *             self._is_image = True             # <<<<<<<<<<<<<<
 *         else:
 *             self._thisptr.get().observation_f = <FLOAT_t*> observation.data
 */
    __Pyx_TraceLine(994,0,__PYX_ERR(0, 994, __pyx_L1_error))
    __pyx_v_self->_is_image = 1;

    /* "minari/dataset.pyx":991
 * 
 *         # assign observation
 *         if observation_shape.size() == 3:             # <<<<<<<<<<<<<<
 *             self._thisptr.get().observation_i = <UINT8_t*> observation.data
 *             self._thisptr.get().next_observation_i = <UINT8_t*> next_observation.data
 */
    goto __pyx_L8;
  }

  /* "minari/dataset.pyx":996
 *             self._is_image = True
 *         else:
 *             self._thisptr.get().observation_f = <FLOAT_t*> observation.data             # <<<<<<<<<<<<<<
 *             self._thisptr.get().next_observation_f = <FLOAT_t*> next_observation.data
 *             self._is_image = False
 */
  __Pyx_TraceLine(996,0,__PYX_ERR(0, 996, __pyx_L1_error))
  /*else*/ {
    __pyx_v_self->_thisptr.get()->observation_f = ((__pyx_t_6minari_7dataset_FLOAT_t *)__pyx_v_observation->data);

    /* "minari/dataset.pyx":997
 *         else:
 *             self._thisptr.get().observation_f = <FLOAT_t*> observation.data
 *             self._thisptr.get().next_observation_f = <FLOAT_t*> next_observation.data             # <<<<<<<<<<<<<<
 *             self._is_image = False
 * 
 */
    __Pyx_TraceLine(997,0,__PYX_ERR(0, 997, __pyx_L1_error))
    __pyx_v_self->_thisptr.get()->next_observation_f = ((__pyx_t_6minari_7dataset_FLOAT_t *)__pyx_v_next_observation->data);

    /* "minari/dataset.pyx":998
 *             self._thisptr.get().observation_f = <FLOAT_t*> observation.data
 *             self._thisptr.get().next_observation_f = <FLOAT_t*> next_observation.data
 *             self._is_image = False             # <<<<<<<<<<<<<<
 * 
 *         # assign action
 */
    __Pyx_TraceLine(998,0,__PYX_ERR(0, 998, __pyx_L1_error))
    __pyx_v_self->_is_image = 0;
  }
  __pyx_L8:;

  /* "minari/dataset.pyx":1003
 *         cdef np.ndarray[FLOAT_t, ndim=1] action_f
 *         cdef int action_i
 *         if isinstance(action, np.ndarray):             # <<<<<<<<<<<<<<
 *             action_f = np.asarray(action, dtype=np.float32)
 *             self._thisptr.get().action_f = <FLOAT_t*> action_f.data
 */
  __Pyx_TraceLine(1003,0,__PYX_ERR(0, 1003, __pyx_L1_error))
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_action, __pyx_ptype_5numpy_ndarray); 
  __pyx_t_8 = (__pyx_t_1 != 0);
  if (__pyx_t_8) {

    /* "minari/dataset.pyx":1004
 *         cdef int action_i
 *         if isinstance(action, np.ndarray):
 *             action_f = np.asarray(action, dtype=np.float32)             # <<<<<<<<<<<<<<
 *             self._thisptr.get().action_f = <FLOAT_t*> action_f.data
 *             self._is_discrete = False
 */
    __Pyx_TraceLine(1004,0,__PYX_ERR(0, 1004, __pyx_L1_error))
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_action);
    __Pyx_GIVEREF(__pyx_v_action);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_action);
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 1004, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1004, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_action_f.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_action_f.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_6minari_7dataset_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_action_f.rcbuffer->pybuffer, (PyObject*)__pyx_v_action_f, &__Pyx_TypeInfo_nn___pyx_t_6minari_7dataset_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_action_f.diminfo[0].strides = __pyx_pybuffernd_action_f.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_action_f.diminfo[0].shape = __pyx_pybuffernd_action_f.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1004, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_action_f = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "minari/dataset.pyx":1005
 *         if isinstance(action, np.ndarray):
 *             action_f = np.asarray(action, dtype=np.float32)
 *             self._thisptr.get().action_f = <FLOAT_t*> action_f.data             # <<<<<<<<<<<<<<
 *             self._is_discrete = False
 *         else:
 */
    __Pyx_TraceLine(1005,0,__PYX_ERR(0, 1005, __pyx_L1_error))
    __pyx_v_self->_thisptr.get()->action_f = ((__pyx_t_6minari_7dataset_FLOAT_t *)__pyx_v_action_f->data);

    /* "minari/dataset.pyx":1006
 *             action_f = np.asarray(action, dtype=np.float32)
 *             self._thisptr.get().action_f = <FLOAT_t*> action_f.data
 *             self._is_discrete = False             # <<<<<<<<<<<<<<
 *         else:
 *             action_i = action
 */
    __Pyx_TraceLine(1006,0,__PYX_ERR(0, 1006, __pyx_L1_error))
    __pyx_v_self->_is_discrete = 0;

    /* "minari/dataset.pyx":1003
 *         cdef np.ndarray[FLOAT_t, ndim=1] action_f
 *         cdef int action_i
 *         if isinstance(action, np.ndarray):             # <<<<<<<<<<<<<<
 *             action_f = np.asarray(action, dtype=np.float32)
 *             self._thisptr.get().action_f = <FLOAT_t*> action_f.data
 */
    goto __pyx_L9;
  }

  /* "minari/dataset.pyx":1008
 *             self._is_discrete = False
 *         else:
 *             action_i = action             # <<<<<<<<<<<<<<
 *             self._thisptr.get().action_i = action_i
 *             self._is_discrete = True
 */
  __Pyx_TraceLine(1008,0,__PYX_ERR(0, 1008, __pyx_L1_error))
  /*else*/ {
    __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_action); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1008, __pyx_L1_error)
    __pyx_v_action_i = __pyx_t_10;

    /* "minari/dataset.pyx":1009
 *         else:
 *             action_i = action
 *             self._thisptr.get().action_i = action_i             # <<<<<<<<<<<<<<
 *             self._is_discrete = True
 * 
 */
    __Pyx_TraceLine(1009,0,__PYX_ERR(0, 1009, __pyx_L1_error))
    __pyx_v_self->_thisptr.get()->action_i = __pyx_v_action_i;

    /* "minari/dataset.pyx":1010
 *             action_i = action
 *             self._thisptr.get().action_i = action_i
 *             self._is_discrete = True             # <<<<<<<<<<<<<<
 * 
 *         self._observation = observation
 */
    __Pyx_TraceLine(1010,0,__PYX_ERR(0, 1010, __pyx_L1_error))
    __pyx_v_self->_is_discrete = 1;
  }
  __pyx_L9:;

  /* "minari/dataset.pyx":1012
 *             self._is_discrete = True
 * 
 *         self._observation = observation             # <<<<<<<<<<<<<<
 *         self._action = action
 *         self._next_observation = next_observation
 */
  __Pyx_TraceLine(1012,0,__PYX_ERR(0, 1012, __pyx_L1_error))
  __Pyx_INCREF(((PyObject *)__pyx_v_observation));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_observation));
  __Pyx_GOTREF(__pyx_v_self->_observation);
  __Pyx_DECREF(__pyx_v_self->_observation);
  __pyx_v_self->_observation = ((PyObject *)__pyx_v_observation);

  /* "minari/dataset.pyx":1013
 * 
 *         self._observation = observation
 *         self._action = action             # <<<<<<<<<<<<<<
 *         self._next_observation = next_observation
 *         self._prev_transition = prev_transition
 */
  __Pyx_TraceLine(1013,0,__PYX_ERR(0, 1013, __pyx_L1_error))
  __Pyx_INCREF(__pyx_v_action);
  __Pyx_GIVEREF(__pyx_v_action);
  __Pyx_GOTREF(__pyx_v_self->_action);
  __Pyx_DECREF(__pyx_v_self->_action);
  __pyx_v_self->_action = __pyx_v_action;

  /* "minari/dataset.pyx":1014
 *         self._observation = observation
 *         self._action = action
 *         self._next_observation = next_observation             # <<<<<<<<<<<<<<
 *         self._prev_transition = prev_transition
 *         self._next_transition = next_transition
 */
  __Pyx_TraceLine(1014,0,__PYX_ERR(0, 1014, __pyx_L1_error))
  __Pyx_INCREF(((PyObject *)__pyx_v_next_observation));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_next_observation));
  __Pyx_GOTREF(__pyx_v_self->_next_observation);
  __Pyx_DECREF(__pyx_v_self->_next_observation);
  __pyx_v_self->_next_observation = ((PyObject *)__pyx_v_next_observation);

  /* "minari/dataset.pyx":1015
 *         self._action = action
 *         self._next_observation = next_observation
 *         self._prev_transition = prev_transition             # <<<<<<<<<<<<<<
 *         self._next_transition = next_transition
 * 
 */
  __Pyx_TraceLine(1015,0,__PYX_ERR(0, 1015, __pyx_L1_error))
  __Pyx_INCREF(((PyObject *)__pyx_v_prev_transition));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_prev_transition));
  __Pyx_GOTREF(__pyx_v_self->_prev_transition);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_prev_transition));
  __pyx_v_self->_prev_transition = __pyx_v_prev_transition;

  /* "minari/dataset.pyx":1016
 *         self._next_observation = next_observation
 *         self._prev_transition = prev_transition
 *         self._next_transition = next_transition             # <<<<<<<<<<<<<<
 * 
 *     cdef TransitionPtr get_ptr(self):
 */
  __Pyx_TraceLine(1016,0,__PYX_ERR(0, 1016, __pyx_L1_error))
  __Pyx_INCREF(((PyObject *)__pyx_v_next_transition));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_next_transition));
  __Pyx_GOTREF(__pyx_v_self->_next_transition);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_next_transition));
  __pyx_v_self->_next_transition = __pyx_v_next_transition;

  /* "minari/dataset.pyx":946
 *     cdef Transition _next_transition
 * 
 *     def __cinit__(             # <<<<<<<<<<<<<<
 *         self,
 *         vector[int] observation_shape,
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_action_f.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("minari.dataset.Transition.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_action_f.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_action_f);
  __Pyx_XDECREF((PyObject *)__pyx_v_observation);
  __Pyx_XDECREF((PyObject *)__pyx_v_next_observation);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1018
 *         self._next_transition = next_transition
 * 
 *     cdef TransitionPtr get_ptr(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr
 * 
 */

static __pyx_t_6minari_7dataset_TransitionPtr __pyx_f_6minari_7dataset_10Transition_get_ptr(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self) {
  __pyx_t_6minari_7dataset_TransitionPtr __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_ptr", 0);
  __Pyx_TraceCall("get_ptr", __pyx_f[0], 1018, 0, __PYX_ERR(0, 1018, __pyx_L1_error));

  /* "minari/dataset.pyx":1019
 * 
 *     cdef TransitionPtr get_ptr(self):
 *         return self._thisptr             # <<<<<<<<<<<<<<
 * 
 *     def get_observation_shape(self):
 */
  __Pyx_TraceLine(1019,0,__PYX_ERR(0, 1019, __pyx_L1_error))
  __pyx_r = __pyx_v_self->_thisptr;
  goto __pyx_L0;

  /* "minari/dataset.pyx":1018
 *         self._next_transition = next_transition
 * 
 *     cdef TransitionPtr get_ptr(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("minari.dataset.Transition.get_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1021
 *         return self._thisptr
 * 
 *     def get_observation_shape(self):             # <<<<<<<<<<<<<<
 *         """ Returns observation shape.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_10Transition_3get_observation_shape(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6minari_7dataset_10Transition_2get_observation_shape[] = " Returns observation shape.\n\n        Returns:\n            tuple: observation shape.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_10Transition_3get_observation_shape = {"get_observation_shape", (PyCFunction)__pyx_pw_6minari_7dataset_10Transition_3get_observation_shape, METH_NOARGS, __pyx_doc_6minari_7dataset_10Transition_2get_observation_shape};
static PyObject *__pyx_pw_6minari_7dataset_10Transition_3get_observation_shape(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_observation_shape (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition_2get_observation_shape(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_10Transition_2get_observation_shape(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__73)
  __Pyx_RefNannySetupContext("get_observation_shape", 0);
  __Pyx_TraceCall("get_observation_shape", __pyx_f[0], 1021, 0, __PYX_ERR(0, 1021, __pyx_L1_error));

  /* "minari/dataset.pyx":1028
 * 
 *         """
 *         return tuple(self._thisptr.get().observation_shape)             # <<<<<<<<<<<<<<
 * 
 *     def get_action_size(self):
 */
  __Pyx_TraceLine(1028,0,__PYX_ERR(0, 1028, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_vector_to_py_int(__pyx_v_self->_thisptr.get()->observation_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":1021
 *         return self._thisptr
 * 
 *     def get_observation_shape(self):             # <<<<<<<<<<<<<<
 *         """ Returns observation shape.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("minari.dataset.Transition.get_observation_shape", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1030
 *         return tuple(self._thisptr.get().observation_shape)
 * 
 *     def get_action_size(self):             # <<<<<<<<<<<<<<
 *         """ Returns dimension of action-space.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_10Transition_5get_action_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6minari_7dataset_10Transition_4get_action_size[] = " Returns dimension of action-space.\n\n        Returns:\n            int: dimension of action-space.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_10Transition_5get_action_size = {"get_action_size", (PyCFunction)__pyx_pw_6minari_7dataset_10Transition_5get_action_size, METH_NOARGS, __pyx_doc_6minari_7dataset_10Transition_4get_action_size};
static PyObject *__pyx_pw_6minari_7dataset_10Transition_5get_action_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_action_size (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition_4get_action_size(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_10Transition_4get_action_size(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__74)
  __Pyx_RefNannySetupContext("get_action_size", 0);
  __Pyx_TraceCall("get_action_size", __pyx_f[0], 1030, 0, __PYX_ERR(0, 1030, __pyx_L1_error));

  /* "minari/dataset.pyx":1037
 * 
 *         """
 *         return self._thisptr.get().action_size             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1037,0,__PYX_ERR(0, 1037, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_thisptr.get()->action_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":1030
 *         return tuple(self._thisptr.get().observation_shape)
 * 
 *     def get_action_size(self):             # <<<<<<<<<<<<<<
 *         """ Returns dimension of action-space.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.Transition.get_action_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1040
 * 
 *     @property
 *     def is_discrete(self):             # <<<<<<<<<<<<<<
 *         """Returns flag of discrete action-space.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_10Transition_11is_discrete_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_10Transition_11is_discrete_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition_11is_discrete___get__(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_10Transition_11is_discrete___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1040, 0, __PYX_ERR(0, 1040, __pyx_L1_error));

  /* "minari/dataset.pyx":1047
 * 
 *         """
 *         return self._is_discrete             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1047,0,__PYX_ERR(0, 1047, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_is_discrete); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":1040
 * 
 *     @property
 *     def is_discrete(self):             # <<<<<<<<<<<<<<
 *         """Returns flag of discrete action-space.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.Transition.is_discrete.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1050
 * 
 *     @property
 *     def observation(self):             # <<<<<<<<<<<<<<
 *         """ Returns observation at `t`.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_10Transition_11observation_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_10Transition_11observation_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition_11observation___get__(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_10Transition_11observation___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1050, 0, __PYX_ERR(0, 1050, __pyx_L1_error));

  /* "minari/dataset.pyx":1057
 * 
 *         """
 *         return self._observation             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1057,0,__PYX_ERR(0, 1057, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_observation);
  __pyx_r = __pyx_v_self->_observation;
  goto __pyx_L0;

  /* "minari/dataset.pyx":1050
 * 
 *     @property
 *     def observation(self):             # <<<<<<<<<<<<<<
 *         """ Returns observation at `t`.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("minari.dataset.Transition.observation.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1060
 * 
 *     @property
 *     def action(self):             # <<<<<<<<<<<<<<
 *         """ Returns action at `t`.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_10Transition_6action_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_10Transition_6action_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition_6action___get__(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_10Transition_6action___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1060, 0, __PYX_ERR(0, 1060, __pyx_L1_error));

  /* "minari/dataset.pyx":1067
 * 
 *         """
 *         return self._action             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1067,0,__PYX_ERR(0, 1067, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_action);
  __pyx_r = __pyx_v_self->_action;
  goto __pyx_L0;

  /* "minari/dataset.pyx":1060
 * 
 *     @property
 *     def action(self):             # <<<<<<<<<<<<<<
 *         """ Returns action at `t`.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("minari.dataset.Transition.action.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1070
 * 
 *     @property
 *     def reward(self):             # <<<<<<<<<<<<<<
 *         """ Returns reward at `t`.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_10Transition_6reward_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_10Transition_6reward_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition_6reward___get__(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_10Transition_6reward___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1070, 0, __PYX_ERR(0, 1070, __pyx_L1_error));

  /* "minari/dataset.pyx":1077
 * 
 *         """
 *         return self._thisptr.get().reward             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1077,0,__PYX_ERR(0, 1077, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->_thisptr.get()->reward); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":1070
 * 
 *     @property
 *     def reward(self):             # <<<<<<<<<<<<<<
 *         """ Returns reward at `t`.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.Transition.reward.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1080
 * 
 *     @property
 *     def next_observation(self):             # <<<<<<<<<<<<<<
 *         """ Returns observation at `t+1`.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_10Transition_16next_observation_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_10Transition_16next_observation_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition_16next_observation___get__(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_10Transition_16next_observation___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1080, 0, __PYX_ERR(0, 1080, __pyx_L1_error));

  /* "minari/dataset.pyx":1087
 * 
 *         """
 *         return self._next_observation             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1087,0,__PYX_ERR(0, 1087, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_next_observation);
  __pyx_r = __pyx_v_self->_next_observation;
  goto __pyx_L0;

  /* "minari/dataset.pyx":1080
 * 
 *     @property
 *     def next_observation(self):             # <<<<<<<<<<<<<<
 *         """ Returns observation at `t+1`.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("minari.dataset.Transition.next_observation.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1090
 * 
 *     @property
 *     def termination(self):             # <<<<<<<<<<<<<<
 *         """ Returns termination flag at `t+1`.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_10Transition_11termination_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_10Transition_11termination_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition_11termination___get__(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_10Transition_11termination___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1090, 0, __PYX_ERR(0, 1090, __pyx_L1_error));

  /* "minari/dataset.pyx":1097
 * 
 *         """
 *         return self._thisptr.get().termination             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1097,0,__PYX_ERR(0, 1097, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->_thisptr.get()->termination); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":1090
 * 
 *     @property
 *     def termination(self):             # <<<<<<<<<<<<<<
 *         """ Returns termination flag at `t+1`.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.Transition.termination.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1100
 * 
 *     @property
 *     def truncation(self):             # <<<<<<<<<<<<<<
 *         """ Returns truncation flag at `t+1`.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_10Transition_10truncation_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_10Transition_10truncation_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition_10truncation___get__(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_10Transition_10truncation___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1100, 0, __PYX_ERR(0, 1100, __pyx_L1_error));

  /* "minari/dataset.pyx":1107
 * 
 *         """
 *         return self._thisptr.get().truncation             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1107,0,__PYX_ERR(0, 1107, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->_thisptr.get()->truncation); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":1100
 * 
 *     @property
 *     def truncation(self):             # <<<<<<<<<<<<<<
 *         """ Returns truncation flag at `t+1`.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.Transition.truncation.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1110
 * 
 *     @property
 *     def prev_transition(self):             # <<<<<<<<<<<<<<
 *         """ Returns pointer to the previous transition.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_10Transition_15prev_transition_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_10Transition_15prev_transition_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition_15prev_transition___get__(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_10Transition_15prev_transition___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1110, 0, __PYX_ERR(0, 1110, __pyx_L1_error));

  /* "minari/dataset.pyx":1119
 * 
 *         """
 *         return self._prev_transition             # <<<<<<<<<<<<<<
 * 
 *     @prev_transition.setter
 */
  __Pyx_TraceLine(1119,0,__PYX_ERR(0, 1119, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_prev_transition));
  __pyx_r = ((PyObject *)__pyx_v_self->_prev_transition);
  goto __pyx_L0;

  /* "minari/dataset.pyx":1110
 * 
 *     @property
 *     def prev_transition(self):             # <<<<<<<<<<<<<<
 *         """ Returns pointer to the previous transition.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("minari.dataset.Transition.prev_transition.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1122
 * 
 *     @prev_transition.setter
 *     def prev_transition(self, Transition transition):             # <<<<<<<<<<<<<<
 *         """ Sets transition to ``prev_transition``.
 * 
 */

/* Python wrapper */
static int __pyx_pw_6minari_7dataset_10Transition_15prev_transition_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_transition); /*proto*/
static int __pyx_pw_6minari_7dataset_10Transition_15prev_transition_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_transition) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_transition), __pyx_ptype_6minari_7dataset_Transition, 1, "transition", 0))) __PYX_ERR(0, 1122, __pyx_L1_error)
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition_15prev_transition_2__set__(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self), ((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_transition));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6minari_7dataset_10Transition_15prev_transition_2__set__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self, struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_transition) {
  __pyx_t_6minari_7dataset_TransitionPtr __pyx_v_ptr;
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceCall("__set__", __pyx_f[0], 1122, 0, __PYX_ERR(0, 1122, __pyx_L1_error));

  /* "minari/dataset.pyx":1129
 * 
 *         """
 *         assert isinstance(transition, Transition)             # <<<<<<<<<<<<<<
 *         cdef TransitionPtr ptr
 *         ptr = transition.get_ptr()
 */
  __Pyx_TraceLine(1129,0,__PYX_ERR(0, 1129, __pyx_L1_error))
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_transition), __pyx_ptype_6minari_7dataset_Transition); 
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 1129, __pyx_L1_error)
    }
  }
  #endif

  /* "minari/dataset.pyx":1131
 *         assert isinstance(transition, Transition)
 *         cdef TransitionPtr ptr
 *         ptr = transition.get_ptr()             # <<<<<<<<<<<<<<
 *         self._thisptr.get().prev_transition = ptr
 *         self._prev_transition = transition
 */
  __Pyx_TraceLine(1131,0,__PYX_ERR(0, 1131, __pyx_L1_error))
  __pyx_v_ptr = ((struct __pyx_vtabstruct_6minari_7dataset_Transition *)__pyx_v_transition->__pyx_vtab)->get_ptr(__pyx_v_transition);

  /* "minari/dataset.pyx":1132
 *         cdef TransitionPtr ptr
 *         ptr = transition.get_ptr()
 *         self._thisptr.get().prev_transition = ptr             # <<<<<<<<<<<<<<
 *         self._prev_transition = transition
 * 
 */
  __Pyx_TraceLine(1132,0,__PYX_ERR(0, 1132, __pyx_L1_error))
  __pyx_v_self->_thisptr.get()->prev_transition = __pyx_v_ptr;

  /* "minari/dataset.pyx":1133
 *         ptr = transition.get_ptr()
 *         self._thisptr.get().prev_transition = ptr
 *         self._prev_transition = transition             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1133,0,__PYX_ERR(0, 1133, __pyx_L1_error))
  __Pyx_INCREF(((PyObject *)__pyx_v_transition));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_transition));
  __Pyx_GOTREF(__pyx_v_self->_prev_transition);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_prev_transition));
  __pyx_v_self->_prev_transition = __pyx_v_transition;

  /* "minari/dataset.pyx":1122
 * 
 *     @prev_transition.setter
 *     def prev_transition(self, Transition transition):             # <<<<<<<<<<<<<<
 *         """ Sets transition to ``prev_transition``.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("minari.dataset.Transition.prev_transition.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1136
 * 
 *     @property
 *     def next_transition(self):             # <<<<<<<<<<<<<<
 *         """ Returns pointer to the next transition.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_10Transition_15next_transition_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_10Transition_15next_transition_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition_15next_transition___get__(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_10Transition_15next_transition___get__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1136, 0, __PYX_ERR(0, 1136, __pyx_L1_error));

  /* "minari/dataset.pyx":1145
 * 
 *         """
 *         return self._next_transition             # <<<<<<<<<<<<<<
 * 
 *     @next_transition.setter
 */
  __Pyx_TraceLine(1145,0,__PYX_ERR(0, 1145, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_next_transition));
  __pyx_r = ((PyObject *)__pyx_v_self->_next_transition);
  goto __pyx_L0;

  /* "minari/dataset.pyx":1136
 * 
 *     @property
 *     def next_transition(self):             # <<<<<<<<<<<<<<
 *         """ Returns pointer to the next transition.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("minari.dataset.Transition.next_transition.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1148
 * 
 *     @next_transition.setter
 *     def next_transition(self, Transition transition):             # <<<<<<<<<<<<<<
 *         """ Sets transition to ``next_transition``.
 * 
 */

/* Python wrapper */
static int __pyx_pw_6minari_7dataset_10Transition_15next_transition_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_transition); /*proto*/
static int __pyx_pw_6minari_7dataset_10Transition_15next_transition_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_transition) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_transition), __pyx_ptype_6minari_7dataset_Transition, 1, "transition", 0))) __PYX_ERR(0, 1148, __pyx_L1_error)
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition_15next_transition_2__set__(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self), ((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_transition));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6minari_7dataset_10Transition_15next_transition_2__set__(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self, struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_transition) {
  __pyx_t_6minari_7dataset_TransitionPtr __pyx_v_ptr;
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceCall("__set__", __pyx_f[0], 1148, 0, __PYX_ERR(0, 1148, __pyx_L1_error));

  /* "minari/dataset.pyx":1155
 * 
 *         """
 *         assert isinstance(transition, Transition)             # <<<<<<<<<<<<<<
 *         cdef TransitionPtr ptr
 *         ptr = transition.get_ptr()
 */
  __Pyx_TraceLine(1155,0,__PYX_ERR(0, 1155, __pyx_L1_error))
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_transition), __pyx_ptype_6minari_7dataset_Transition); 
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 1155, __pyx_L1_error)
    }
  }
  #endif

  /* "minari/dataset.pyx":1157
 *         assert isinstance(transition, Transition)
 *         cdef TransitionPtr ptr
 *         ptr = transition.get_ptr()             # <<<<<<<<<<<<<<
 *         self._thisptr.get().next_transition = ptr
 *         self._next_transition = transition
 */
  __Pyx_TraceLine(1157,0,__PYX_ERR(0, 1157, __pyx_L1_error))
  __pyx_v_ptr = ((struct __pyx_vtabstruct_6minari_7dataset_Transition *)__pyx_v_transition->__pyx_vtab)->get_ptr(__pyx_v_transition);

  /* "minari/dataset.pyx":1158
 *         cdef TransitionPtr ptr
 *         ptr = transition.get_ptr()
 *         self._thisptr.get().next_transition = ptr             # <<<<<<<<<<<<<<
 *         self._next_transition = transition
 * 
 */
  __Pyx_TraceLine(1158,0,__PYX_ERR(0, 1158, __pyx_L1_error))
  __pyx_v_self->_thisptr.get()->next_transition = __pyx_v_ptr;

  /* "minari/dataset.pyx":1159
 *         ptr = transition.get_ptr()
 *         self._thisptr.get().next_transition = ptr
 *         self._next_transition = transition             # <<<<<<<<<<<<<<
 * 
 *     def clear_links(self):
 */
  __Pyx_TraceLine(1159,0,__PYX_ERR(0, 1159, __pyx_L1_error))
  __Pyx_INCREF(((PyObject *)__pyx_v_transition));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_transition));
  __Pyx_GOTREF(__pyx_v_self->_next_transition);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_next_transition));
  __pyx_v_self->_next_transition = __pyx_v_transition;

  /* "minari/dataset.pyx":1148
 * 
 *     @next_transition.setter
 *     def next_transition(self, Transition transition):             # <<<<<<<<<<<<<<
 *         """ Sets transition to ``next_transition``.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("minari.dataset.Transition.next_transition.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1161
 *         self._next_transition = transition
 * 
 *     def clear_links(self):             # <<<<<<<<<<<<<<
 *         """ Clears links to the next and previous transitions.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_10Transition_7clear_links(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6minari_7dataset_10Transition_6clear_links[] = " Clears links to the next and previous transitions.\n\n        This method is necessary to call when freeing this instance by GC.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_10Transition_7clear_links = {"clear_links", (PyCFunction)__pyx_pw_6minari_7dataset_10Transition_7clear_links, METH_NOARGS, __pyx_doc_6minari_7dataset_10Transition_6clear_links};
static PyObject *__pyx_pw_6minari_7dataset_10Transition_7clear_links(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear_links (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition_6clear_links(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_10Transition_6clear_links(struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__75)
  __Pyx_RefNannySetupContext("clear_links", 0);
  __Pyx_TraceCall("clear_links", __pyx_f[0], 1161, 0, __PYX_ERR(0, 1161, __pyx_L1_error));

  /* "minari/dataset.pyx":1167
 * 
 *         """
 *         self._prev_transition = None             # <<<<<<<<<<<<<<
 *         self._next_transition = None
 *         self._thisptr.get().prev_transition = <TransitionPtr> nullptr
 */
  __Pyx_TraceLine(1167,0,__PYX_ERR(0, 1167, __pyx_L1_error))
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_prev_transition);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_prev_transition));
  __pyx_v_self->_prev_transition = ((struct __pyx_obj_6minari_7dataset_Transition *)Py_None);

  /* "minari/dataset.pyx":1168
 *         """
 *         self._prev_transition = None
 *         self._next_transition = None             # <<<<<<<<<<<<<<
 *         self._thisptr.get().prev_transition = <TransitionPtr> nullptr
 *         self._thisptr.get().next_transition = <TransitionPtr> nullptr
 */
  __Pyx_TraceLine(1168,0,__PYX_ERR(0, 1168, __pyx_L1_error))
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_next_transition);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_next_transition));
  __pyx_v_self->_next_transition = ((struct __pyx_obj_6minari_7dataset_Transition *)Py_None);

  /* "minari/dataset.pyx":1169
 *         self._prev_transition = None
 *         self._next_transition = None
 *         self._thisptr.get().prev_transition = <TransitionPtr> nullptr             # <<<<<<<<<<<<<<
 *         self._thisptr.get().next_transition = <TransitionPtr> nullptr
 * 
 */
  __Pyx_TraceLine(1169,0,__PYX_ERR(0, 1169, __pyx_L1_error))
  __pyx_v_self->_thisptr.get()->prev_transition = ((__pyx_t_6minari_7dataset_TransitionPtr)nullptr);

  /* "minari/dataset.pyx":1170
 *         self._next_transition = None
 *         self._thisptr.get().prev_transition = <TransitionPtr> nullptr
 *         self._thisptr.get().next_transition = <TransitionPtr> nullptr             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_TraceLine(1170,0,__PYX_ERR(0, 1170, __pyx_L1_error))
  __pyx_v_self->_thisptr.get()->next_transition = ((__pyx_t_6minari_7dataset_TransitionPtr)nullptr);

  /* "minari/dataset.pyx":1161
 *         self._next_transition = transition
 * 
 *     def clear_links(self):             # <<<<<<<<<<<<<<
 *         """ Clears links to the next and previous transitions.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("minari.dataset.Transition.clear_links", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_10Transition_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_10Transition_9__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw_6minari_7dataset_10Transition_9__reduce_cython__, METH_NOARGS, 0};
static PyObject *__pyx_pw_6minari_7dataset_10Transition_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition_8__reduce_cython__(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_10Transition_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__76)
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __Pyx_TraceLine(2,0,__PYX_ERR(1, 2, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__77, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.Transition.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_10Transition_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_10Transition_11__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw_6minari_7dataset_10Transition_11__setstate_cython__, METH_O, 0};
static PyObject *__pyx_pw_6minari_7dataset_10Transition_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_10Transition_10__setstate_cython__(((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_10Transition_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__78)
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[1], 3, 0, __PYX_ERR(1, 3, __pyx_L1_error));

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __Pyx_TraceLine(4,0,__PYX_ERR(1, 4, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__79, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.Transition.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1173
 * 
 * 
 * def trace_back_and_clear(transition):             # <<<<<<<<<<<<<<
 *     """ Traces transitions and clear all links.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_9trace_back_and_clear(PyObject *__pyx_self, PyObject *__pyx_v_transition); /*proto*/
static char __pyx_doc_6minari_7dataset_8trace_back_and_clear[] = " Traces transitions and clear all links.\n\n    Args:\n        transition (minari.dataset.Transition): transition.\n\n    ";
static PyMethodDef __pyx_mdef_6minari_7dataset_9trace_back_and_clear = {"trace_back_and_clear", (PyCFunction)__pyx_pw_6minari_7dataset_9trace_back_and_clear, METH_O, __pyx_doc_6minari_7dataset_8trace_back_and_clear};
static PyObject *__pyx_pw_6minari_7dataset_9trace_back_and_clear(PyObject *__pyx_self, PyObject *__pyx_v_transition) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trace_back_and_clear (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_8trace_back_and_clear(__pyx_self, ((PyObject *)__pyx_v_transition));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_8trace_back_and_clear(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_transition) {
  PyObject *__pyx_v_prev_transition = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__80)
  __Pyx_RefNannySetupContext("trace_back_and_clear", 0);
  __Pyx_TraceCall("trace_back_and_clear", __pyx_f[0], 1173, 0, __PYX_ERR(0, 1173, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_transition);

  /* "minari/dataset.pyx":1180
 * 
 *     """
 *     while True:             # <<<<<<<<<<<<<<
 *         if transition is None:
 *             break
 */
  __Pyx_TraceLine(1180,0,__PYX_ERR(0, 1180, __pyx_L1_error))
  while (1) {

    /* "minari/dataset.pyx":1181
 *     """
 *     while True:
 *         if transition is None:             # <<<<<<<<<<<<<<
 *             break
 *         prev_transition = transition.prev_transition
 */
    __Pyx_TraceLine(1181,0,__PYX_ERR(0, 1181, __pyx_L1_error))
    __pyx_t_1 = (__pyx_v_transition == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "minari/dataset.pyx":1182
 *     while True:
 *         if transition is None:
 *             break             # <<<<<<<<<<<<<<
 *         prev_transition = transition.prev_transition
 *         transition.clear_links()
 */
      __Pyx_TraceLine(1182,0,__PYX_ERR(0, 1182, __pyx_L1_error))
      goto __pyx_L4_break;

      /* "minari/dataset.pyx":1181
 *     """
 *     while True:
 *         if transition is None:             # <<<<<<<<<<<<<<
 *             break
 *         prev_transition = transition.prev_transition
 */
    }

    /* "minari/dataset.pyx":1183
 *         if transition is None:
 *             break
 *         prev_transition = transition.prev_transition             # <<<<<<<<<<<<<<
 *         transition.clear_links()
 *         transition = prev_transition
 */
    __Pyx_TraceLine(1183,0,__PYX_ERR(0, 1183, __pyx_L1_error))
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_transition, __pyx_n_s_prev_transition); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1183, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_prev_transition, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "minari/dataset.pyx":1184
 *             break
 *         prev_transition = transition.prev_transition
 *         transition.clear_links()             # <<<<<<<<<<<<<<
 *         transition = prev_transition
 * 
 */
    __Pyx_TraceLine(1184,0,__PYX_ERR(0, 1184, __pyx_L1_error))
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_transition, __pyx_n_s_clear_links); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1184, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1184, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "minari/dataset.pyx":1185
 *         prev_transition = transition.prev_transition
 *         transition.clear_links()
 *         transition = prev_transition             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_TraceLine(1185,0,__PYX_ERR(0, 1185, __pyx_L1_error))
    __Pyx_INCREF(__pyx_v_prev_transition);
    __Pyx_DECREF_SET(__pyx_v_transition, __pyx_v_prev_transition);
  }
  __pyx_L4_break:;

  /* "minari/dataset.pyx":1173
 * 
 * 
 * def trace_back_and_clear(transition):             # <<<<<<<<<<<<<<
 *     """ Traces transitions and clear all links.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("minari.dataset.trace_back_and_clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_prev_transition);
  __Pyx_XDECREF(__pyx_v_transition);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1190
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * cdef void _stack_frames(             # <<<<<<<<<<<<<<
 *     TransitionPtr transition,
 *     UINT8_t* stack,
 */

static void __pyx_f_6minari_7dataset__stack_frames(__pyx_t_6minari_7dataset_TransitionPtr __pyx_v_transition, __pyx_t_6minari_7dataset_UINT8_t *__pyx_v_stack, int __pyx_v_n_frames, struct __pyx_opt_args_6minari_7dataset__stack_frames *__pyx_optional_args) {

  /* "minari/dataset.pyx":1194
 *     UINT8_t* stack,
 *     int n_frames,
 *     bool stack_next=False,             # <<<<<<<<<<<<<<
 * ) nogil:
 *     cdef UINT8_t* observation_ptr
 */
  bool __pyx_v_stack_next = ((bool)0);
  __pyx_t_6minari_7dataset_UINT8_t *__pyx_v_observation_ptr;
  int __pyx_v_c;
  int __pyx_v_h;
  int __pyx_v_w;
  int __pyx_v_image_size;
  __pyx_t_6minari_7dataset_TransitionPtr __pyx_v_t;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_head_channel;
  int __pyx_v_tail_channel;
  __Pyx_TraceDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __pyx_t_5numpy_uint8_t *__pyx_t_6;
  long __pyx_t_7;
  long __pyx_t_8;
  int __pyx_t_9;
  std::shared_ptr<minari::CTransition>  __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("_stack_frames", __pyx_f[0], 1190, 1, __PYX_ERR(0, 1190, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_stack_next = __pyx_optional_args->stack_next;
    }
  }

  /* "minari/dataset.pyx":1197
 * ) nogil:
 *     cdef UINT8_t* observation_ptr
 *     cdef int c = transition.get().observation_shape[0]             # <<<<<<<<<<<<<<
 *     cdef int h = transition.get().observation_shape[1]
 *     cdef int w = transition.get().observation_shape[2]
 */
  __Pyx_TraceLine(1197,1,__PYX_ERR(0, 1197, __pyx_L1_error))
  __pyx_v_c = (__pyx_v_transition.get()->observation_shape[0]);

  /* "minari/dataset.pyx":1198
 *     cdef UINT8_t* observation_ptr
 *     cdef int c = transition.get().observation_shape[0]
 *     cdef int h = transition.get().observation_shape[1]             # <<<<<<<<<<<<<<
 *     cdef int w = transition.get().observation_shape[2]
 *     cdef int image_size = c * h * w
 */
  __Pyx_TraceLine(1198,1,__PYX_ERR(0, 1198, __pyx_L1_error))
  __pyx_v_h = (__pyx_v_transition.get()->observation_shape[1]);

  /* "minari/dataset.pyx":1199
 *     cdef int c = transition.get().observation_shape[0]
 *     cdef int h = transition.get().observation_shape[1]
 *     cdef int w = transition.get().observation_shape[2]             # <<<<<<<<<<<<<<
 *     cdef int image_size = c * h * w
 * 
 */
  __Pyx_TraceLine(1199,1,__PYX_ERR(0, 1199, __pyx_L1_error))
  __pyx_v_w = (__pyx_v_transition.get()->observation_shape[2]);

  /* "minari/dataset.pyx":1200
 *     cdef int h = transition.get().observation_shape[1]
 *     cdef int w = transition.get().observation_shape[2]
 *     cdef int image_size = c * h * w             # <<<<<<<<<<<<<<
 * 
 *     # fill terminal observation with zeros
 */
  __Pyx_TraceLine(1200,1,__PYX_ERR(0, 1200, __pyx_L1_error))
  __pyx_v_image_size = ((__pyx_v_c * __pyx_v_h) * __pyx_v_w);

  /* "minari/dataset.pyx":1203
 * 
 *     # fill terminal observation with zeros
 *     if stack_next and (transition.get().termination or transition.get().truncation):  # todo: check if correct??             # <<<<<<<<<<<<<<
 *         memset(stack, 0, image_size * n_frames)
 *         return
 */
  __Pyx_TraceLine(1203,1,__PYX_ERR(0, 1203, __pyx_L1_error))
  __pyx_t_2 = (__pyx_v_stack_next != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_transition.get()->termination != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_transition.get()->truncation != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "minari/dataset.pyx":1204
 *     # fill terminal observation with zeros
 *     if stack_next and (transition.get().termination or transition.get().truncation):  # todo: check if correct??
 *         memset(stack, 0, image_size * n_frames)             # <<<<<<<<<<<<<<
 *         return
 * 
 */
    __Pyx_TraceLine(1204,1,__PYX_ERR(0, 1204, __pyx_L1_error))
    (void)(memset(__pyx_v_stack, 0, (__pyx_v_image_size * __pyx_v_n_frames)));

    /* "minari/dataset.pyx":1205
 *     if stack_next and (transition.get().termination or transition.get().truncation):  # todo: check if correct??
 *         memset(stack, 0, image_size * n_frames)
 *         return             # <<<<<<<<<<<<<<
 * 
 *     # stack frames
 */
    __Pyx_TraceLine(1205,1,__PYX_ERR(0, 1205, __pyx_L1_error))
    goto __pyx_L0;

    /* "minari/dataset.pyx":1203
 * 
 *     # fill terminal observation with zeros
 *     if stack_next and (transition.get().termination or transition.get().truncation):  # todo: check if correct??             # <<<<<<<<<<<<<<
 *         memset(stack, 0, image_size * n_frames)
 *         return
 */
  }

  /* "minari/dataset.pyx":1208
 * 
 *     # stack frames
 *     cdef TransitionPtr t = transition             # <<<<<<<<<<<<<<
 *     cdef int i, j
 *     cdef int head_channel
 */
  __Pyx_TraceLine(1208,1,__PYX_ERR(0, 1208, __pyx_L1_error))
  __pyx_v_t = __pyx_v_transition;

  /* "minari/dataset.pyx":1214
 *     cdef int offset
 *     cdef int index
 *     for i in range(n_frames):             # <<<<<<<<<<<<<<
 * 
 *         tail_channel = n_frames * c - i * c
 */
  __Pyx_TraceLine(1214,1,__PYX_ERR(0, 1214, __pyx_L1_error))
  __pyx_t_3 = __pyx_v_n_frames;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "minari/dataset.pyx":1216
 *     for i in range(n_frames):
 * 
 *         tail_channel = n_frames * c - i * c             # <<<<<<<<<<<<<<
 *         head_channel = tail_channel - c
 * 
 */
    __Pyx_TraceLine(1216,1,__PYX_ERR(0, 1216, __pyx_L1_error))
    __pyx_v_tail_channel = ((__pyx_v_n_frames * __pyx_v_c) - (__pyx_v_i * __pyx_v_c));

    /* "minari/dataset.pyx":1217
 * 
 *         tail_channel = n_frames * c - i * c
 *         head_channel = tail_channel - c             # <<<<<<<<<<<<<<
 * 
 *         if stack_next:
 */
    __Pyx_TraceLine(1217,1,__PYX_ERR(0, 1217, __pyx_L1_error))
    __pyx_v_head_channel = (__pyx_v_tail_channel - __pyx_v_c);

    /* "minari/dataset.pyx":1219
 *         head_channel = tail_channel - c
 * 
 *         if stack_next:             # <<<<<<<<<<<<<<
 *             observation_ptr = t.get().next_observation_i
 *         else:
 */
    __Pyx_TraceLine(1219,1,__PYX_ERR(0, 1219, __pyx_L1_error))
    __pyx_t_1 = (__pyx_v_stack_next != 0);
    if (__pyx_t_1) {

      /* "minari/dataset.pyx":1220
 * 
 *         if stack_next:
 *             observation_ptr = t.get().next_observation_i             # <<<<<<<<<<<<<<
 *         else:
 *             observation_ptr = t.get().observation_i
 */
      __Pyx_TraceLine(1220,1,__PYX_ERR(0, 1220, __pyx_L1_error))
      __pyx_t_6 = __pyx_v_t.get()->next_observation_i;
      __pyx_v_observation_ptr = __pyx_t_6;

      /* "minari/dataset.pyx":1219
 *         head_channel = tail_channel - c
 * 
 *         if stack_next:             # <<<<<<<<<<<<<<
 *             observation_ptr = t.get().next_observation_i
 *         else:
 */
      goto __pyx_L9;
    }

    /* "minari/dataset.pyx":1222
 *             observation_ptr = t.get().next_observation_i
 *         else:
 *             observation_ptr = t.get().observation_i             # <<<<<<<<<<<<<<
 * 
 *         memcpy(stack + head_channel * h * w, observation_ptr, image_size)
 */
    __Pyx_TraceLine(1222,1,__PYX_ERR(0, 1222, __pyx_L1_error))
    /*else*/ {
      __pyx_t_6 = __pyx_v_t.get()->observation_i;
      __pyx_v_observation_ptr = __pyx_t_6;
    }
    __pyx_L9:;

    /* "minari/dataset.pyx":1224
 *             observation_ptr = t.get().observation_i
 * 
 *         memcpy(stack + head_channel * h * w, observation_ptr, image_size)             # <<<<<<<<<<<<<<
 * 
 *         if t.get().prev_transition == nullptr:
 */
    __Pyx_TraceLine(1224,1,__PYX_ERR(0, 1224, __pyx_L1_error))
    (void)(memcpy((__pyx_v_stack + ((__pyx_v_head_channel * __pyx_v_h) * __pyx_v_w)), __pyx_v_observation_ptr, __pyx_v_image_size));

    /* "minari/dataset.pyx":1226
 *         memcpy(stack + head_channel * h * w, observation_ptr, image_size)
 * 
 *         if t.get().prev_transition == nullptr:             # <<<<<<<<<<<<<<
 *             # fill rests with the last frame
 *             for j in range(n_frames - i - 1):
 */
    __Pyx_TraceLine(1226,1,__PYX_ERR(0, 1226, __pyx_L1_error))
    __pyx_t_1 = ((__pyx_v_t.get()->prev_transition == nullptr) != 0);
    if (__pyx_t_1) {

      /* "minari/dataset.pyx":1228
 *         if t.get().prev_transition == nullptr:
 *             # fill rests with the last frame
 *             for j in range(n_frames - i - 1):             # <<<<<<<<<<<<<<
 *                 tail_channel = n_frames * c - (i + j + 1) * c
 *                 head_channel = tail_channel - c
 */
      __Pyx_TraceLine(1228,1,__PYX_ERR(0, 1228, __pyx_L1_error))
      __pyx_t_7 = ((__pyx_v_n_frames - __pyx_v_i) - 1);
      __pyx_t_8 = __pyx_t_7;
      for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
        __pyx_v_j = __pyx_t_9;

        /* "minari/dataset.pyx":1229
 *             # fill rests with the last frame
 *             for j in range(n_frames - i - 1):
 *                 tail_channel = n_frames * c - (i + j + 1) * c             # <<<<<<<<<<<<<<
 *                 head_channel = tail_channel - c
 *                 memcpy(stack + head_channel * h * w, t.get().observation_i, image_size)
 */
        __Pyx_TraceLine(1229,1,__PYX_ERR(0, 1229, __pyx_L1_error))
        __pyx_v_tail_channel = ((__pyx_v_n_frames * __pyx_v_c) - (((__pyx_v_i + __pyx_v_j) + 1) * __pyx_v_c));

        /* "minari/dataset.pyx":1230
 *             for j in range(n_frames - i - 1):
 *                 tail_channel = n_frames * c - (i + j + 1) * c
 *                 head_channel = tail_channel - c             # <<<<<<<<<<<<<<
 *                 memcpy(stack + head_channel * h * w, t.get().observation_i, image_size)
 *             break
 */
        __Pyx_TraceLine(1230,1,__PYX_ERR(0, 1230, __pyx_L1_error))
        __pyx_v_head_channel = (__pyx_v_tail_channel - __pyx_v_c);

        /* "minari/dataset.pyx":1231
 *                 tail_channel = n_frames * c - (i + j + 1) * c
 *                 head_channel = tail_channel - c
 *                 memcpy(stack + head_channel * h * w, t.get().observation_i, image_size)             # <<<<<<<<<<<<<<
 *             break
 *         t = t.get().prev_transition
 */
        __Pyx_TraceLine(1231,1,__PYX_ERR(0, 1231, __pyx_L1_error))
        (void)(memcpy((__pyx_v_stack + ((__pyx_v_head_channel * __pyx_v_h) * __pyx_v_w)), __pyx_v_t.get()->observation_i, __pyx_v_image_size));
      }

      /* "minari/dataset.pyx":1232
 *                 head_channel = tail_channel - c
 *                 memcpy(stack + head_channel * h * w, t.get().observation_i, image_size)
 *             break             # <<<<<<<<<<<<<<
 *         t = t.get().prev_transition
 * 
 */
      __Pyx_TraceLine(1232,1,__PYX_ERR(0, 1232, __pyx_L1_error))
      goto __pyx_L8_break;

      /* "minari/dataset.pyx":1226
 *         memcpy(stack + head_channel * h * w, observation_ptr, image_size)
 * 
 *         if t.get().prev_transition == nullptr:             # <<<<<<<<<<<<<<
 *             # fill rests with the last frame
 *             for j in range(n_frames - i - 1):
 */
    }

    /* "minari/dataset.pyx":1233
 *                 memcpy(stack + head_channel * h * w, t.get().observation_i, image_size)
 *             break
 *         t = t.get().prev_transition             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_TraceLine(1233,1,__PYX_ERR(0, 1233, __pyx_L1_error))
    __pyx_t_10 = __pyx_v_t.get()->prev_transition;
    __pyx_v_t = __pyx_t_10;
  }
  __pyx_L8_break:;

  /* "minari/dataset.pyx":1190
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * cdef void _stack_frames(             # <<<<<<<<<<<<<<
 *     TransitionPtr transition,
 *     UINT8_t* stack,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("minari.dataset._stack_frames", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 1);
}

/* "minari/dataset.pyx":1277
 *     cdef np.ndarray _n_steps
 * 
 *     def __cinit__(             # <<<<<<<<<<<<<<
 *         self,
 *         list transitions not None,
 */

/* Python wrapper */
static int __pyx_pw_6minari_7dataset_19TransitionMiniBatch_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6minari_7dataset_19TransitionMiniBatch_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_transitions = 0;
  int __pyx_v_n_frames;
  int __pyx_v_n_steps;
  float __pyx_v_gamma;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transitions_2,&__pyx_n_s_n_frames,&__pyx_n_s_n_steps,&__pyx_n_s_gamma,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transitions_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_frames);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_steps);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gamma);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1277, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_transitions = ((PyObject*)values[0]);
    if (values[1]) {
      __pyx_v_n_frames = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n_frames == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1280, __pyx_L3_error)
    } else {
      __pyx_v_n_frames = ((int)1);
    }
    if (values[2]) {
      __pyx_v_n_steps = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_n_steps == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1281, __pyx_L3_error)
    } else {
      __pyx_v_n_steps = ((int)1);
    }
    if (values[3]) {
      __pyx_v_gamma = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_gamma == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1282, __pyx_L3_error)
    } else {
      __pyx_v_gamma = ((float)0.99);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1277, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("minari.dataset.TransitionMiniBatch.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_transitions), (&PyList_Type), 0, "transitions", 1))) __PYX_ERR(0, 1279, __pyx_L1_error)
  __pyx_r = __pyx_pf_6minari_7dataset_19TransitionMiniBatch___cinit__(((struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self), __pyx_v_transitions, __pyx_v_n_frames, __pyx_v_n_steps, __pyx_v_gamma);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6minari_7dataset_19TransitionMiniBatch___cinit__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self, PyObject *__pyx_v_transitions, int __pyx_v_n_frames, int __pyx_v_n_steps, float __pyx_v_gamma) {
  PyObject *__pyx_v_observation_shape = 0;
  CYTHON_UNUSED int __pyx_v_observation_ndim;
  PyObject *__pyx_v_observation_dtype = NULL;
  PyObject *__pyx_v_c = NULL;
  PyObject *__pyx_v_h = NULL;
  PyObject *__pyx_v_w = NULL;
  int __pyx_v_action_size;
  PyObject *__pyx_v_action_shape = 0;
  PyObject *__pyx_v_action_dtype = NULL;
  int __pyx_v_size;
  bool __pyx_v_is_image;
  int __pyx_v_is_discrete;
  void *__pyx_v_observations_ptr;
  void *__pyx_v_actions_ptr;
  __pyx_t_6minari_7dataset_FLOAT_t *__pyx_v_rewards_ptr;
  void *__pyx_v_next_observations_ptr;
  __pyx_t_6minari_7dataset_FLOAT_t *__pyx_v_terminations_ptr;
  __pyx_t_6minari_7dataset_FLOAT_t *__pyx_v_truncations_ptr;
  __pyx_t_6minari_7dataset_FLOAT_t *__pyx_v_n_steps_ptr;
  int __pyx_v_i;
  struct __pyx_obj_6minari_7dataset_Transition *__pyx_v_transition = 0;
  std::vector<__pyx_t_6minari_7dataset_TransitionPtr>  __pyx_v_transition_ptrs;
  __pyx_t_6minari_7dataset_TransitionPtr __pyx_v_ptr;
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  char *__pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1277, 0, __PYX_ERR(0, 1277, __pyx_L1_error));

  /* "minari/dataset.pyx":1284
 *         float gamma=0.99
 *     ):
 *         self._transitions = transitions             # <<<<<<<<<<<<<<
 * 
 *         # determine observation shape
 */
  __Pyx_TraceLine(1284,0,__PYX_ERR(0, 1284, __pyx_L1_error))
  __Pyx_INCREF(__pyx_v_transitions);
  __Pyx_GIVEREF(__pyx_v_transitions);
  __Pyx_GOTREF(__pyx_v_self->_transitions);
  __Pyx_DECREF(__pyx_v_self->_transitions);
  __pyx_v_self->_transitions = __pyx_v_transitions;

  /* "minari/dataset.pyx":1287
 * 
 *         # determine observation shape
 *         cdef tuple observation_shape = transitions[0].get_observation_shape()             # <<<<<<<<<<<<<<
 *         cdef int observation_ndim = len(observation_shape)
 *         observation_dtype = transitions[0].observation.dtype
 */
  __Pyx_TraceLine(1287,0,__PYX_ERR(0, 1287, __pyx_L1_error))
  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_transitions, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_observation_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 1287, __pyx_L1_error)
  __pyx_v_observation_shape = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "minari/dataset.pyx":1288
 *         # determine observation shape
 *         cdef tuple observation_shape = transitions[0].get_observation_shape()
 *         cdef int observation_ndim = len(observation_shape)             # <<<<<<<<<<<<<<
 *         observation_dtype = transitions[0].observation.dtype
 *         if len(observation_shape) == 3 and n_frames > 1:
 */
  __Pyx_TraceLine(1288,0,__PYX_ERR(0, 1288, __pyx_L1_error))
  if (unlikely(__pyx_v_observation_shape == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 1288, __pyx_L1_error)
  }
  __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v_observation_shape); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1288, __pyx_L1_error)
  __pyx_v_observation_ndim = __pyx_t_4;

  /* "minari/dataset.pyx":1289
 *         cdef tuple observation_shape = transitions[0].get_observation_shape()
 *         cdef int observation_ndim = len(observation_shape)
 *         observation_dtype = transitions[0].observation.dtype             # <<<<<<<<<<<<<<
 *         if len(observation_shape) == 3 and n_frames > 1:
 *             c, h, w = observation_shape
 */
  __Pyx_TraceLine(1289,0,__PYX_ERR(0, 1289, __pyx_L1_error))
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_transitions, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_observation); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_observation_dtype = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "minari/dataset.pyx":1290
 *         cdef int observation_ndim = len(observation_shape)
 *         observation_dtype = transitions[0].observation.dtype
 *         if len(observation_shape) == 3 and n_frames > 1:             # <<<<<<<<<<<<<<
 *             c, h, w = observation_shape
 *             observation_shape = (n_frames * c, h, w)
 */
  __Pyx_TraceLine(1290,0,__PYX_ERR(0, 1290, __pyx_L1_error))
  if (unlikely(__pyx_v_observation_shape == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 1290, __pyx_L1_error)
  }
  __pyx_t_4 = PyTuple_GET_SIZE(__pyx_v_observation_shape); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1290, __pyx_L1_error)
  __pyx_t_6 = ((__pyx_t_4 == 3) != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = ((__pyx_v_n_frames > 1) != 0);
  __pyx_t_5 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_5) {

    /* "minari/dataset.pyx":1291
 *         observation_dtype = transitions[0].observation.dtype
 *         if len(observation_shape) == 3 and n_frames > 1:
 *             c, h, w = observation_shape             # <<<<<<<<<<<<<<
 *             observation_shape = (n_frames * c, h, w)
 * 
 */
    __Pyx_TraceLine(1291,0,__PYX_ERR(0, 1291, __pyx_L1_error))
    if (likely(__pyx_v_observation_shape != Py_None)) {
      PyObject* sequence = __pyx_v_observation_shape;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1291, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      #endif
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1291, __pyx_L1_error)
    }
    __pyx_v_c = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_h = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_w = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "minari/dataset.pyx":1292
 *         if len(observation_shape) == 3 and n_frames > 1:
 *             c, h, w = observation_shape
 *             observation_shape = (n_frames * c, h, w)             # <<<<<<<<<<<<<<
 * 
 *         # determine action shape
 */
    __Pyx_TraceLine(1292,0,__PYX_ERR(0, 1292, __pyx_L1_error))
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_n_frames); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_h);
    __Pyx_GIVEREF(__pyx_v_h);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_h);
    __Pyx_INCREF(__pyx_v_w);
    __Pyx_GIVEREF(__pyx_v_w);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_w);
    __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_observation_shape, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "minari/dataset.pyx":1290
 *         cdef int observation_ndim = len(observation_shape)
 *         observation_dtype = transitions[0].observation.dtype
 *         if len(observation_shape) == 3 and n_frames > 1:             # <<<<<<<<<<<<<<
 *             c, h, w = observation_shape
 *             observation_shape = (n_frames * c, h, w)
 */
  }

  /* "minari/dataset.pyx":1295
 * 
 *         # determine action shape
 *         cdef int action_size = transitions[0].get_action_size()             # <<<<<<<<<<<<<<
 *         cdef tuple action_shape = tuple()
 *         action_dtype = np.int32
 */
  __Pyx_TraceLine(1295,0,__PYX_ERR(0, 1295, __pyx_L1_error))
  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_transitions, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_action_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_action_size = __pyx_t_7;

  /* "minari/dataset.pyx":1296
 *         # determine action shape
 *         cdef int action_size = transitions[0].get_action_size()
 *         cdef tuple action_shape = tuple()             # <<<<<<<<<<<<<<
 *         action_dtype = np.int32
 *         if isinstance(transitions[0].action, np.ndarray):
 */
  __Pyx_TraceLine(1296,0,__PYX_ERR(0, 1296, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)(&PyTuple_Type))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_action_shape = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "minari/dataset.pyx":1297
 *         cdef int action_size = transitions[0].get_action_size()
 *         cdef tuple action_shape = tuple()
 *         action_dtype = np.int32             # <<<<<<<<<<<<<<
 *         if isinstance(transitions[0].action, np.ndarray):
 *             action_shape = (action_size,)
 */
  __Pyx_TraceLine(1297,0,__PYX_ERR(0, 1297, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_action_dtype = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "minari/dataset.pyx":1298
 *         cdef tuple action_shape = tuple()
 *         action_dtype = np.int32
 *         if isinstance(transitions[0].action, np.ndarray):             # <<<<<<<<<<<<<<
 *             action_shape = (action_size,)
 *             action_dtype = np.float32
 */
  __Pyx_TraceLine(1298,0,__PYX_ERR(0, 1298, __pyx_L1_error))
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_transitions, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_action); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_TypeCheck(__pyx_t_2, __pyx_ptype_5numpy_ndarray); 
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "minari/dataset.pyx":1299
 *         action_dtype = np.int32
 *         if isinstance(transitions[0].action, np.ndarray):
 *             action_shape = (action_size,)             # <<<<<<<<<<<<<<
 *             action_dtype = np.float32
 * 
 */
    __Pyx_TraceLine(1299,0,__PYX_ERR(0, 1299, __pyx_L1_error))
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_action_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1299, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1299, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_action_shape, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "minari/dataset.pyx":1300
 *         if isinstance(transitions[0].action, np.ndarray):
 *             action_shape = (action_size,)
 *             action_dtype = np.float32             # <<<<<<<<<<<<<<
 * 
 *         # allocate batch data
 */
    __Pyx_TraceLine(1300,0,__PYX_ERR(0, 1300, __pyx_L1_error))
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1300, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1300, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_action_dtype, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "minari/dataset.pyx":1298
 *         cdef tuple action_shape = tuple()
 *         action_dtype = np.int32
 *         if isinstance(transitions[0].action, np.ndarray):             # <<<<<<<<<<<<<<
 *             action_shape = (action_size,)
 *             action_dtype = np.float32
 */
  }

  /* "minari/dataset.pyx":1303
 * 
 *         # allocate batch data
 *         cdef int size = len(transitions)             # <<<<<<<<<<<<<<
 *         self._observations = np.empty(
 *             (size,) + observation_shape, dtype=observation_dtype
 */
  __Pyx_TraceLine(1303,0,__PYX_ERR(0, 1303, __pyx_L1_error))
  __pyx_t_4 = PyList_GET_SIZE(__pyx_v_transitions); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1303, __pyx_L1_error)
  __pyx_v_size = __pyx_t_4;

  /* "minari/dataset.pyx":1304
 *         # allocate batch data
 *         cdef int size = len(transitions)
 *         self._observations = np.empty(             # <<<<<<<<<<<<<<
 *             (size,) + observation_shape, dtype=observation_dtype
 *         )
 */
  __Pyx_TraceLine(1304,0,__PYX_ERR(0, 1304, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":1305
 *         cdef int size = len(transitions)
 *         self._observations = np.empty(
 *             (size,) + observation_shape, dtype=observation_dtype             # <<<<<<<<<<<<<<
 *         )
 *         self._actions = np.empty((size,) + action_shape, dtype=action_dtype)
 */
  __Pyx_TraceLine(1305,0,__PYX_ERR(0, 1305, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_v_observation_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":1304
 *         # allocate batch data
 *         cdef int size = len(transitions)
 *         self._observations = np.empty(             # <<<<<<<<<<<<<<
 *             (size,) + observation_shape, dtype=observation_dtype
 *         )
 */
  __Pyx_TraceLine(1304,0,__PYX_ERR(0, 1304, __pyx_L1_error))
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "minari/dataset.pyx":1305
 *         cdef int size = len(transitions)
 *         self._observations = np.empty(
 *             (size,) + observation_shape, dtype=observation_dtype             # <<<<<<<<<<<<<<
 *         )
 *         self._actions = np.empty((size,) + action_shape, dtype=action_dtype)
 */
  __Pyx_TraceLine(1305,0,__PYX_ERR(0, 1305, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_v_observation_dtype) < 0) __PYX_ERR(0, 1305, __pyx_L1_error)

  /* "minari/dataset.pyx":1304
 *         # allocate batch data
 *         cdef int size = len(transitions)
 *         self._observations = np.empty(             # <<<<<<<<<<<<<<
 *             (size,) + observation_shape, dtype=observation_dtype
 *         )
 */
  __Pyx_TraceLine(1304,0,__PYX_ERR(0, 1304, __pyx_L1_error))
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_8);
  __Pyx_GOTREF(__pyx_v_self->_observations);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_observations));
  __pyx_v_self->_observations = ((PyArrayObject *)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "minari/dataset.pyx":1307
 *             (size,) + observation_shape, dtype=observation_dtype
 *         )
 *         self._actions = np.empty((size,) + action_shape, dtype=action_dtype)             # <<<<<<<<<<<<<<
 *         self._rewards = np.empty((size, 1), dtype=np.float32)
 *         self._next_observations = np.empty(
 */
  __Pyx_TraceLine(1307,0,__PYX_ERR(0, 1307, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_size); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Add(__pyx_t_3, __pyx_v_action_shape); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_v_action_dtype) < 0) __PYX_ERR(0, 1307, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1307, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_actions);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_actions));
  __pyx_v_self->_actions = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "minari/dataset.pyx":1308
 *         )
 *         self._actions = np.empty((size,) + action_shape, dtype=action_dtype)
 *         self._rewards = np.empty((size, 1), dtype=np.float32)             # <<<<<<<<<<<<<<
 *         self._next_observations = np.empty(
 *             (size,) + observation_shape, dtype=observation_dtype
 */
  __Pyx_TraceLine(1308,0,__PYX_ERR(0, 1308, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 1308, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1308, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_9);
  __Pyx_GOTREF(__pyx_v_self->_rewards);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_rewards));
  __pyx_v_self->_rewards = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "minari/dataset.pyx":1309
 *         self._actions = np.empty((size,) + action_shape, dtype=action_dtype)
 *         self._rewards = np.empty((size, 1), dtype=np.float32)
 *         self._next_observations = np.empty(             # <<<<<<<<<<<<<<
 *             (size,) + observation_shape, dtype=observation_dtype
 *         )
 */
  __Pyx_TraceLine(1309,0,__PYX_ERR(0, 1309, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "minari/dataset.pyx":1310
 *         self._rewards = np.empty((size, 1), dtype=np.float32)
 *         self._next_observations = np.empty(
 *             (size,) + observation_shape, dtype=observation_dtype             # <<<<<<<<<<<<<<
 *         )
 *         self._terminations = np.empty((size, 1), dtype=np.float32)
 */
  __Pyx_TraceLine(1310,0,__PYX_ERR(0, 1310, __pyx_L1_error))
  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = PyNumber_Add(__pyx_t_1, __pyx_v_observation_shape); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":1309
 *         self._actions = np.empty((size,) + action_shape, dtype=action_dtype)
 *         self._rewards = np.empty((size, 1), dtype=np.float32)
 *         self._next_observations = np.empty(             # <<<<<<<<<<<<<<
 *             (size,) + observation_shape, dtype=observation_dtype
 *         )
 */
  __Pyx_TraceLine(1309,0,__PYX_ERR(0, 1309, __pyx_L1_error))
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
  __pyx_t_9 = 0;

  /* "minari/dataset.pyx":1310
 *         self._rewards = np.empty((size, 1), dtype=np.float32)
 *         self._next_observations = np.empty(
 *             (size,) + observation_shape, dtype=observation_dtype             # <<<<<<<<<<<<<<
 *         )
 *         self._terminations = np.empty((size, 1), dtype=np.float32)
 */
  __Pyx_TraceLine(1310,0,__PYX_ERR(0, 1310, __pyx_L1_error))
  __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_v_observation_dtype) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)

  /* "minari/dataset.pyx":1309
 *         self._actions = np.empty((size,) + action_shape, dtype=action_dtype)
 *         self._rewards = np.empty((size, 1), dtype=np.float32)
 *         self._next_observations = np.empty(             # <<<<<<<<<<<<<<
 *             (size,) + observation_shape, dtype=observation_dtype
 *         )
 */
  __Pyx_TraceLine(1309,0,__PYX_ERR(0, 1309, __pyx_L1_error))
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_8);
  __Pyx_GOTREF(__pyx_v_self->_next_observations);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_next_observations));
  __pyx_v_self->_next_observations = ((PyArrayObject *)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "minari/dataset.pyx":1312
 *             (size,) + observation_shape, dtype=observation_dtype
 *         )
 *         self._terminations = np.empty((size, 1), dtype=np.float32)             # <<<<<<<<<<<<<<
 *         self._truncations = np.empty((size, 1), dtype=np.float32)
 *         self._n_steps = np.empty((size, 1), dtype=np.float32)
 */
  __Pyx_TraceLine(1312,0,__PYX_ERR(0, 1312, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_empty); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_size); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_1);
  __pyx_t_8 = 0;
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 1312, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1312, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->_terminations);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_terminations));
  __pyx_v_self->_terminations = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "minari/dataset.pyx":1313
 *         )
 *         self._terminations = np.empty((size, 1), dtype=np.float32)
 *         self._truncations = np.empty((size, 1), dtype=np.float32)             # <<<<<<<<<<<<<<
 *         self._n_steps = np.empty((size, 1), dtype=np.float32)
 * 
 */
  __Pyx_TraceLine(1313,0,__PYX_ERR(0, 1313, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_int_1);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_truncations);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_truncations));
  __pyx_v_self->_truncations = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "minari/dataset.pyx":1314
 *         self._terminations = np.empty((size, 1), dtype=np.float32)
 *         self._truncations = np.empty((size, 1), dtype=np.float32)
 *         self._n_steps = np.empty((size, 1), dtype=np.float32)             # <<<<<<<<<<<<<<
 * 
 *         # determine flags
 */
  __Pyx_TraceLine(1314,0,__PYX_ERR(0, 1314, __pyx_L1_error))
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 1314, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1314, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_9);
  __Pyx_GOTREF(__pyx_v_self->_n_steps);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_n_steps));
  __pyx_v_self->_n_steps = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "minari/dataset.pyx":1319
 *         cdef bool is_image
 *         cdef bool is_dicsrete
 *         is_image = len(transitions[0].get_observation_shape()) == 3             # <<<<<<<<<<<<<<
 *         is_discrete = not isinstance(transitions[0].action, np.ndarray)
 * 
 */
  __Pyx_TraceLine(1319,0,__PYX_ERR(0, 1319, __pyx_L1_error))
  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_transitions, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_observation_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_9 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1319, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_is_image = (__pyx_t_4 == 3);

  /* "minari/dataset.pyx":1320
 *         cdef bool is_dicsrete
 *         is_image = len(transitions[0].get_observation_shape()) == 3
 *         is_discrete = not isinstance(transitions[0].action, np.ndarray)             # <<<<<<<<<<<<<<
 * 
 *         # prepare pointers to batch data
 */
  __Pyx_TraceLine(1320,0,__PYX_ERR(0, 1320, __pyx_L1_error))
  __pyx_t_9 = __Pyx_GetItemInt_List(__pyx_v_transitions, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_action); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_6 = __Pyx_TypeCheck(__pyx_t_3, __pyx_ptype_5numpy_ndarray); 
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_is_discrete = (!(__pyx_t_6 != 0));

  /* "minari/dataset.pyx":1323
 * 
 *         # prepare pointers to batch data
 *         cdef void* observations_ptr = self._observations.data             # <<<<<<<<<<<<<<
 *         cdef void* actions_ptr = self._actions.data
 *         cdef FLOAT_t* rewards_ptr = <FLOAT_t*> self._rewards.data
 */
  __Pyx_TraceLine(1323,0,__PYX_ERR(0, 1323, __pyx_L1_error))
  __pyx_t_10 = __pyx_v_self->_observations->data;
  __pyx_v_observations_ptr = __pyx_t_10;

  /* "minari/dataset.pyx":1324
 *         # prepare pointers to batch data
 *         cdef void* observations_ptr = self._observations.data
 *         cdef void* actions_ptr = self._actions.data             # <<<<<<<<<<<<<<
 *         cdef FLOAT_t* rewards_ptr = <FLOAT_t*> self._rewards.data
 *         cdef void* next_observations_ptr = self._next_observations.data
 */
  __Pyx_TraceLine(1324,0,__PYX_ERR(0, 1324, __pyx_L1_error))
  __pyx_t_10 = __pyx_v_self->_actions->data;
  __pyx_v_actions_ptr = __pyx_t_10;

  /* "minari/dataset.pyx":1325
 *         cdef void* observations_ptr = self._observations.data
 *         cdef void* actions_ptr = self._actions.data
 *         cdef FLOAT_t* rewards_ptr = <FLOAT_t*> self._rewards.data             # <<<<<<<<<<<<<<
 *         cdef void* next_observations_ptr = self._next_observations.data
 *         cdef FLOAT_t* terminations_ptr = <FLOAT_t*> self._terminations.data
 */
  __Pyx_TraceLine(1325,0,__PYX_ERR(0, 1325, __pyx_L1_error))
  __pyx_v_rewards_ptr = ((__pyx_t_6minari_7dataset_FLOAT_t *)__pyx_v_self->_rewards->data);

  /* "minari/dataset.pyx":1326
 *         cdef void* actions_ptr = self._actions.data
 *         cdef FLOAT_t* rewards_ptr = <FLOAT_t*> self._rewards.data
 *         cdef void* next_observations_ptr = self._next_observations.data             # <<<<<<<<<<<<<<
 *         cdef FLOAT_t* terminations_ptr = <FLOAT_t*> self._terminations.data
 *         cdef FLOAT_t* truncations_ptr = <FLOAT_t*> self._truncations.data
 */
  __Pyx_TraceLine(1326,0,__PYX_ERR(0, 1326, __pyx_L1_error))
  __pyx_t_10 = __pyx_v_self->_next_observations->data;
  __pyx_v_next_observations_ptr = __pyx_t_10;

  /* "minari/dataset.pyx":1327
 *         cdef FLOAT_t* rewards_ptr = <FLOAT_t*> self._rewards.data
 *         cdef void* next_observations_ptr = self._next_observations.data
 *         cdef FLOAT_t* terminations_ptr = <FLOAT_t*> self._terminations.data             # <<<<<<<<<<<<<<
 *         cdef FLOAT_t* truncations_ptr = <FLOAT_t*> self._truncations.data
 *         cdef FLOAT_t* n_steps_ptr = <FLOAT_t*> self._n_steps.data
 */
  __Pyx_TraceLine(1327,0,__PYX_ERR(0, 1327, __pyx_L1_error))
  __pyx_v_terminations_ptr = ((__pyx_t_6minari_7dataset_FLOAT_t *)__pyx_v_self->_terminations->data);

  /* "minari/dataset.pyx":1328
 *         cdef void* next_observations_ptr = self._next_observations.data
 *         cdef FLOAT_t* terminations_ptr = <FLOAT_t*> self._terminations.data
 *         cdef FLOAT_t* truncations_ptr = <FLOAT_t*> self._truncations.data             # <<<<<<<<<<<<<<
 *         cdef FLOAT_t* n_steps_ptr = <FLOAT_t*> self._n_steps.data
 * 
 */
  __Pyx_TraceLine(1328,0,__PYX_ERR(0, 1328, __pyx_L1_error))
  __pyx_v_truncations_ptr = ((__pyx_t_6minari_7dataset_FLOAT_t *)__pyx_v_self->_truncations->data);

  /* "minari/dataset.pyx":1329
 *         cdef FLOAT_t* terminations_ptr = <FLOAT_t*> self._terminations.data
 *         cdef FLOAT_t* truncations_ptr = <FLOAT_t*> self._truncations.data
 *         cdef FLOAT_t* n_steps_ptr = <FLOAT_t*> self._n_steps.data             # <<<<<<<<<<<<<<
 * 
 *         # get pointers to transitions
 */
  __Pyx_TraceLine(1329,0,__PYX_ERR(0, 1329, __pyx_L1_error))
  __pyx_v_n_steps_ptr = ((__pyx_t_6minari_7dataset_FLOAT_t *)__pyx_v_self->_n_steps->data);

  /* "minari/dataset.pyx":1335
 *         cdef Transition transition
 *         cdef vector[TransitionPtr] transition_ptrs
 *         for i in range(size):             # <<<<<<<<<<<<<<
 *             transition = transitions[i]
 *             transition_ptrs.push_back(transition.get_ptr())
 */
  __Pyx_TraceLine(1335,0,__PYX_ERR(0, 1335, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_size;
  __pyx_t_11 = __pyx_t_7;
  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "minari/dataset.pyx":1336
 *         cdef vector[TransitionPtr] transition_ptrs
 *         for i in range(size):
 *             transition = transitions[i]             # <<<<<<<<<<<<<<
 *             transition_ptrs.push_back(transition.get_ptr())
 * 
 */
    __Pyx_TraceLine(1336,0,__PYX_ERR(0, 1336, __pyx_L1_error))
    __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_transitions, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6minari_7dataset_Transition))))) __PYX_ERR(0, 1336, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_transition, ((struct __pyx_obj_6minari_7dataset_Transition *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "minari/dataset.pyx":1337
 *         for i in range(size):
 *             transition = transitions[i]
 *             transition_ptrs.push_back(transition.get_ptr())             # <<<<<<<<<<<<<<
 * 
 *         # efficient memory copy
 */
    __Pyx_TraceLine(1337,0,__PYX_ERR(0, 1337, __pyx_L1_error))
    try {
      __pyx_v_transition_ptrs.push_back(((struct __pyx_vtabstruct_6minari_7dataset_Transition *)__pyx_v_transition->__pyx_vtab)->get_ptr(__pyx_v_transition));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(0, 1337, __pyx_L1_error)
    }
  }

  /* "minari/dataset.pyx":1341
 *         # efficient memory copy
 *         cdef TransitionPtr ptr
 *         for i in prange(size, nogil=True):             # <<<<<<<<<<<<<<
 *             ptr = transition_ptrs[i]
 *             self._assign_to_batch(
 */
  __Pyx_TraceLine(1341,0,__PYX_ERR(0, 1341, __pyx_L1_error))
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {
        __pyx_t_7 = __pyx_v_size;
        if ((1 == 0)) abort();
        {
            int __pyx_parallel_temp0 = ((int)0xbad0bad0);
            __pyx_t_6minari_7dataset_TransitionPtr __pyx_parallel_temp1;
            const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
            PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
            int __pyx_parallel_why;
            __pyx_parallel_why = 0;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_12 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_12 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    Py_BEGIN_ALLOW_THREADS
                    #endif /* _OPENMP */
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ptr)
                    #endif /* _OPENMP */
                    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){
                        if (__pyx_parallel_why < 2)
                        {
                            __pyx_v_i = (int)(0 + 1 * __pyx_t_11);

                            /* "minari/dataset.pyx":1342
 *         cdef TransitionPtr ptr
 *         for i in prange(size, nogil=True):
 *             ptr = transition_ptrs[i]             # <<<<<<<<<<<<<<
 *             self._assign_to_batch(
 *                 batch_index=i,
 */
                            __Pyx_TraceLine(1342,1,__PYX_ERR(0, 1342, __pyx_L14_error))
                            __pyx_v_ptr = (__pyx_v_transition_ptrs[__pyx_v_i]);

                            /* "minari/dataset.pyx":1343
 *         for i in prange(size, nogil=True):
 *             ptr = transition_ptrs[i]
 *             self._assign_to_batch(             # <<<<<<<<<<<<<<
 *                 batch_index=i,
 *                 ptr=ptr,
 */
                            __Pyx_TraceLine(1343,1,__PYX_ERR(0, 1343, __pyx_L14_error))
                            ((struct __pyx_vtabstruct_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self->__pyx_vtab)->_assign_to_batch(__pyx_v_self, __pyx_v_i, __pyx_v_ptr, __pyx_v_observations_ptr, __pyx_v_actions_ptr, __pyx_v_rewards_ptr, __pyx_v_next_observations_ptr, __pyx_v_terminations_ptr, __pyx_v_truncations_ptr, __pyx_v_n_steps_ptr, __pyx_v_n_frames, __pyx_v_n_steps, __pyx_v_gamma, __pyx_v_is_image, __pyx_v_is_discrete);
                            goto __pyx_L17;
                            __pyx_L14_error:;
                            {
                                #ifdef WITH_THREAD
                                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                #endif
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_exc_type)
                                #endif /* _OPENMP */
                                if (!__pyx_parallel_exc_type) {
                                  __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                  __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                  __Pyx_GOTREF(__pyx_parallel_exc_type);
                                }
                                #ifdef WITH_THREAD
                                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                #endif
                            }
                            __pyx_parallel_why = 4;
                            goto __pyx_L16;
                            __pyx_L16:;
                            #ifdef _OPENMP
                            #pragma omp critical(__pyx_parallel_lastprivates0)
                            #endif /* _OPENMP */
                            {
                                __pyx_parallel_temp0 = __pyx_v_i;
                                __pyx_parallel_temp1 = __pyx_v_ptr;
                            }
                            __pyx_L17:;
                            #ifdef _OPENMP
                            #pragma omp flush(__pyx_parallel_why)
                            #endif /* _OPENMP */
                        }
                    }
                    #ifdef _OPENMP
                    Py_END_ALLOW_THREADS
                    #else
{
#ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    #endif /* _OPENMP */
                    /* Clean up any temporaries */
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                    #ifndef _OPENMP
}
#endif /* _OPENMP */
                }
            }
            if (__pyx_parallel_exc_type) {
              /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
              __pyx_parallel_why = 4;
            }
            if (__pyx_parallel_why) {
              __pyx_v_i = __pyx_parallel_temp0;
              __pyx_v_ptr = __pyx_parallel_temp1;
              switch (__pyx_parallel_why) {
                    case 4:
                {
                    #ifdef WITH_THREAD
                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                    #endif
                    __Pyx_GIVEREF(__pyx_parallel_exc_type);
                    __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                    __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                    #ifdef WITH_THREAD
                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                    #endif
                }
                goto __pyx_L10_error;
              }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "minari/dataset.pyx":1341
 *         # efficient memory copy
 *         cdef TransitionPtr ptr
 *         for i in prange(size, nogil=True):             # <<<<<<<<<<<<<<
 *             ptr = transition_ptrs[i]
 *             self._assign_to_batch(
 */
      __Pyx_TraceLine(1341,1,__PYX_ERR(0, 1341, __pyx_L10_error))
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L11;
        }
        __pyx_L10_error: {
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L1_error;
        }
        __pyx_L11:;
      }
  }

  /* "minari/dataset.pyx":1277
 *     cdef np.ndarray _n_steps
 * 
 *     def __cinit__(             # <<<<<<<<<<<<<<
 *         self,
 *         list transitions not None,
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("minari.dataset.TransitionMiniBatch.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_observation_shape);
  __Pyx_XDECREF(__pyx_v_observation_dtype);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XDECREF(__pyx_v_action_shape);
  __Pyx_XDECREF(__pyx_v_action_dtype);
  __Pyx_XDECREF((PyObject *)__pyx_v_transition);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1360
 *             )
 * 
 *     cdef void _assign_observation(             # <<<<<<<<<<<<<<
 *         self,
 *         int batch_index,
 */

static void __pyx_f_6minari_7dataset_19TransitionMiniBatch__assign_observation(CYTHON_UNUSED struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self, int __pyx_v_batch_index, __pyx_t_6minari_7dataset_TransitionPtr __pyx_v_ptr, void *__pyx_v_observations_ptr, int __pyx_v_n_frames, bool __pyx_v_is_image, bool __pyx_v_is_next) {
  int __pyx_v_offset;
  int __pyx_v_channel;
  int __pyx_v_height;
  int __pyx_v_width;
  void *__pyx_v_src_observation_ptr;
  __Pyx_TraceDeclarations
  int __pyx_t_1;
  struct __pyx_opt_args_6minari_7dataset__stack_frames __pyx_t_2;
  __pyx_t_5numpy_uint8_t *__pyx_t_3;
  __pyx_t_5numpy_float32_t *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("_assign_observation", __pyx_f[0], 1360, 1, __PYX_ERR(0, 1360, __pyx_L1_error));

  /* "minari/dataset.pyx":1371
 *         cdef int offset, channel, height, width
 *         cdef void* src_observation_ptr
 *         if is_image:             # <<<<<<<<<<<<<<
 *             channel = ptr.get().observation_shape[0]
 *             height = ptr.get().observation_shape[1]
 */
  __Pyx_TraceLine(1371,1,__PYX_ERR(0, 1371, __pyx_L1_error))
  __pyx_t_1 = (__pyx_v_is_image != 0);
  if (__pyx_t_1) {

    /* "minari/dataset.pyx":1372
 *         cdef void* src_observation_ptr
 *         if is_image:
 *             channel = ptr.get().observation_shape[0]             # <<<<<<<<<<<<<<
 *             height = ptr.get().observation_shape[1]
 *             width = ptr.get().observation_shape[2]
 */
    __Pyx_TraceLine(1372,1,__PYX_ERR(0, 1372, __pyx_L1_error))
    __pyx_v_channel = (__pyx_v_ptr.get()->observation_shape[0]);

    /* "minari/dataset.pyx":1373
 *         if is_image:
 *             channel = ptr.get().observation_shape[0]
 *             height = ptr.get().observation_shape[1]             # <<<<<<<<<<<<<<
 *             width = ptr.get().observation_shape[2]
 *             # stack frames if necessary
 */
    __Pyx_TraceLine(1373,1,__PYX_ERR(0, 1373, __pyx_L1_error))
    __pyx_v_height = (__pyx_v_ptr.get()->observation_shape[1]);

    /* "minari/dataset.pyx":1374
 *             channel = ptr.get().observation_shape[0]
 *             height = ptr.get().observation_shape[1]
 *             width = ptr.get().observation_shape[2]             # <<<<<<<<<<<<<<
 *             # stack frames if necessary
 *             if n_frames > 1:
 */
    __Pyx_TraceLine(1374,1,__PYX_ERR(0, 1374, __pyx_L1_error))
    __pyx_v_width = (__pyx_v_ptr.get()->observation_shape[2]);

    /* "minari/dataset.pyx":1376
 *             width = ptr.get().observation_shape[2]
 *             # stack frames if necessary
 *             if n_frames > 1:             # <<<<<<<<<<<<<<
 *                 offset = n_frames * batch_index * channel * height * width
 *                 _stack_frames(
 */
    __Pyx_TraceLine(1376,1,__PYX_ERR(0, 1376, __pyx_L1_error))
    __pyx_t_1 = ((__pyx_v_n_frames > 1) != 0);
    if (__pyx_t_1) {

      /* "minari/dataset.pyx":1377
 *             # stack frames if necessary
 *             if n_frames > 1:
 *                 offset = n_frames * batch_index * channel * height * width             # <<<<<<<<<<<<<<
 *                 _stack_frames(
 *                     transition=ptr,
 */
      __Pyx_TraceLine(1377,1,__PYX_ERR(0, 1377, __pyx_L1_error))
      __pyx_v_offset = ((((__pyx_v_n_frames * __pyx_v_batch_index) * __pyx_v_channel) * __pyx_v_height) * __pyx_v_width);

      /* "minari/dataset.pyx":1378
 *             if n_frames > 1:
 *                 offset = n_frames * batch_index * channel * height * width
 *                 _stack_frames(             # <<<<<<<<<<<<<<
 *                     transition=ptr,
 *                     stack=(<UINT8_t*> observations_ptr) + offset,
 */
      __Pyx_TraceLine(1378,1,__PYX_ERR(0, 1378, __pyx_L1_error))
      __pyx_t_2.__pyx_n = 1;
      __pyx_t_2.stack_next = __pyx_v_is_next;
      __pyx_f_6minari_7dataset__stack_frames(__pyx_v_ptr, (((__pyx_t_6minari_7dataset_UINT8_t *)__pyx_v_observations_ptr) + __pyx_v_offset), __pyx_v_n_frames, &__pyx_t_2); 

      /* "minari/dataset.pyx":1376
 *             width = ptr.get().observation_shape[2]
 *             # stack frames if necessary
 *             if n_frames > 1:             # <<<<<<<<<<<<<<
 *                 offset = n_frames * batch_index * channel * height * width
 *                 _stack_frames(
 */
      goto __pyx_L4;
    }

    /* "minari/dataset.pyx":1385
 *                 )
 *             else:
 *                 offset = batch_index * channel * height * width             # <<<<<<<<<<<<<<
 *                 if is_next:
 *                     src_observation_ptr = ptr.get().next_observation_i
 */
    __Pyx_TraceLine(1385,1,__PYX_ERR(0, 1385, __pyx_L1_error))
    /*else*/ {
      __pyx_v_offset = (((__pyx_v_batch_index * __pyx_v_channel) * __pyx_v_height) * __pyx_v_width);

      /* "minari/dataset.pyx":1386
 *             else:
 *                 offset = batch_index * channel * height * width
 *                 if is_next:             # <<<<<<<<<<<<<<
 *                     src_observation_ptr = ptr.get().next_observation_i
 *                 else:
 */
      __Pyx_TraceLine(1386,1,__PYX_ERR(0, 1386, __pyx_L1_error))
      __pyx_t_1 = (__pyx_v_is_next != 0);
      if (__pyx_t_1) {

        /* "minari/dataset.pyx":1387
 *                 offset = batch_index * channel * height * width
 *                 if is_next:
 *                     src_observation_ptr = ptr.get().next_observation_i             # <<<<<<<<<<<<<<
 *                 else:
 *                     src_observation_ptr = ptr.get().observation_i
 */
        __Pyx_TraceLine(1387,1,__PYX_ERR(0, 1387, __pyx_L1_error))
        __pyx_t_3 = __pyx_v_ptr.get()->next_observation_i;
        __pyx_v_src_observation_ptr = __pyx_t_3;

        /* "minari/dataset.pyx":1386
 *             else:
 *                 offset = batch_index * channel * height * width
 *                 if is_next:             # <<<<<<<<<<<<<<
 *                     src_observation_ptr = ptr.get().next_observation_i
 *                 else:
 */
        goto __pyx_L5;
      }

      /* "minari/dataset.pyx":1389
 *                     src_observation_ptr = ptr.get().next_observation_i
 *                 else:
 *                     src_observation_ptr = ptr.get().observation_i             # <<<<<<<<<<<<<<
 *                 memcpy(
 *                     (<UINT8_t*> observations_ptr) + offset,
 */
      __Pyx_TraceLine(1389,1,__PYX_ERR(0, 1389, __pyx_L1_error))
      /*else*/ {
        __pyx_t_3 = __pyx_v_ptr.get()->observation_i;
        __pyx_v_src_observation_ptr = __pyx_t_3;
      }
      __pyx_L5:;

      /* "minari/dataset.pyx":1390
 *                 else:
 *                     src_observation_ptr = ptr.get().observation_i
 *                 memcpy(             # <<<<<<<<<<<<<<
 *                     (<UINT8_t*> observations_ptr) + offset,
 *                     <UINT8_t*> src_observation_ptr,
 */
      __Pyx_TraceLine(1390,1,__PYX_ERR(0, 1390, __pyx_L1_error))
      (void)(memcpy((((__pyx_t_6minari_7dataset_UINT8_t *)__pyx_v_observations_ptr) + __pyx_v_offset), ((__pyx_t_6minari_7dataset_UINT8_t *)__pyx_v_src_observation_ptr), ((__pyx_v_channel * __pyx_v_height) * __pyx_v_width)));
    }
    __pyx_L4:;

    /* "minari/dataset.pyx":1371
 *         cdef int offset, channel, height, width
 *         cdef void* src_observation_ptr
 *         if is_image:             # <<<<<<<<<<<<<<
 *             channel = ptr.get().observation_shape[0]
 *             height = ptr.get().observation_shape[1]
 */
    goto __pyx_L3;
  }

  /* "minari/dataset.pyx":1396
 *                 )
 *         else:
 *             offset = batch_index * ptr.get().observation_shape[0]             # <<<<<<<<<<<<<<
 *             if is_next:
 *                 src_observation_ptr = ptr.get().next_observation_f
 */
  __Pyx_TraceLine(1396,1,__PYX_ERR(0, 1396, __pyx_L1_error))
  /*else*/ {
    __pyx_v_offset = (__pyx_v_batch_index * (__pyx_v_ptr.get()->observation_shape[0]));

    /* "minari/dataset.pyx":1397
 *         else:
 *             offset = batch_index * ptr.get().observation_shape[0]
 *             if is_next:             # <<<<<<<<<<<<<<
 *                 src_observation_ptr = ptr.get().next_observation_f
 *             else:
 */
    __Pyx_TraceLine(1397,1,__PYX_ERR(0, 1397, __pyx_L1_error))
    __pyx_t_1 = (__pyx_v_is_next != 0);
    if (__pyx_t_1) {

      /* "minari/dataset.pyx":1398
 *             offset = batch_index * ptr.get().observation_shape[0]
 *             if is_next:
 *                 src_observation_ptr = ptr.get().next_observation_f             # <<<<<<<<<<<<<<
 *             else:
 *                 src_observation_ptr = ptr.get().observation_f
 */
      __Pyx_TraceLine(1398,1,__PYX_ERR(0, 1398, __pyx_L1_error))
      __pyx_t_4 = __pyx_v_ptr.get()->next_observation_f;
      __pyx_v_src_observation_ptr = __pyx_t_4;

      /* "minari/dataset.pyx":1397
 *         else:
 *             offset = batch_index * ptr.get().observation_shape[0]
 *             if is_next:             # <<<<<<<<<<<<<<
 *                 src_observation_ptr = ptr.get().next_observation_f
 *             else:
 */
      goto __pyx_L6;
    }

    /* "minari/dataset.pyx":1400
 *                 src_observation_ptr = ptr.get().next_observation_f
 *             else:
 *                 src_observation_ptr = ptr.get().observation_f             # <<<<<<<<<<<<<<
 *             memcpy(
 *                 (<FLOAT_t*> observations_ptr) + offset,
 */
    __Pyx_TraceLine(1400,1,__PYX_ERR(0, 1400, __pyx_L1_error))
    /*else*/ {
      __pyx_t_4 = __pyx_v_ptr.get()->observation_f;
      __pyx_v_src_observation_ptr = __pyx_t_4;
    }
    __pyx_L6:;

    /* "minari/dataset.pyx":1401
 *             else:
 *                 src_observation_ptr = ptr.get().observation_f
 *             memcpy(             # <<<<<<<<<<<<<<
 *                 (<FLOAT_t*> observations_ptr) + offset,
 *                 <FLOAT_t*> src_observation_ptr,
 */
    __Pyx_TraceLine(1401,1,__PYX_ERR(0, 1401, __pyx_L1_error))
    (void)(memcpy((((__pyx_t_6minari_7dataset_FLOAT_t *)__pyx_v_observations_ptr) + __pyx_v_offset), ((__pyx_t_6minari_7dataset_FLOAT_t *)__pyx_v_src_observation_ptr), ((__pyx_v_ptr.get()->observation_shape[0]) * (sizeof(__pyx_t_6minari_7dataset_FLOAT_t)))));
  }
  __pyx_L3:;

  /* "minari/dataset.pyx":1360
 *             )
 * 
 *     cdef void _assign_observation(             # <<<<<<<<<<<<<<
 *         self,
 *         int batch_index,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("minari.dataset.TransitionMiniBatch._assign_observation", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 1);
}

/* "minari/dataset.pyx":1407
 *             )
 * 
 *     cdef void _assign_action(             # <<<<<<<<<<<<<<
 *         self,
 *         int batch_index,
 */

static void __pyx_f_6minari_7dataset_19TransitionMiniBatch__assign_action(CYTHON_UNUSED struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self, int __pyx_v_batch_index, __pyx_t_6minari_7dataset_TransitionPtr __pyx_v_ptr, void *__pyx_v_actions_ptr, bool __pyx_v_is_discrete) {
  int __pyx_v_offset;
  void *__pyx_v_src_action_ptr;
  __Pyx_TraceDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __pyx_t_5numpy_float32_t *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("_assign_action", __pyx_f[0], 1407, 1, __PYX_ERR(0, 1407, __pyx_L1_error));

  /* "minari/dataset.pyx":1416
 *         cdef int offset
 *         cdef void* src_action_ptr
 *         if is_discrete:             # <<<<<<<<<<<<<<
 *             ((<INT_t*> actions_ptr) + batch_index)[0] = ptr.get().action_i
 *         else:
 */
  __Pyx_TraceLine(1416,1,__PYX_ERR(0, 1416, __pyx_L1_error))
  __pyx_t_1 = (__pyx_v_is_discrete != 0);
  if (__pyx_t_1) {

    /* "minari/dataset.pyx":1417
 *         cdef void* src_action_ptr
 *         if is_discrete:
 *             ((<INT_t*> actions_ptr) + batch_index)[0] = ptr.get().action_i             # <<<<<<<<<<<<<<
 *         else:
 *             offset = batch_index * ptr.get().action_size
 */
    __Pyx_TraceLine(1417,1,__PYX_ERR(0, 1417, __pyx_L1_error))
    __pyx_t_2 = __pyx_v_ptr.get()->action_i;
    ((((__pyx_t_6minari_7dataset_INT_t *)__pyx_v_actions_ptr) + __pyx_v_batch_index)[0]) = __pyx_t_2;

    /* "minari/dataset.pyx":1416
 *         cdef int offset
 *         cdef void* src_action_ptr
 *         if is_discrete:             # <<<<<<<<<<<<<<
 *             ((<INT_t*> actions_ptr) + batch_index)[0] = ptr.get().action_i
 *         else:
 */
    goto __pyx_L3;
  }

  /* "minari/dataset.pyx":1419
 *             ((<INT_t*> actions_ptr) + batch_index)[0] = ptr.get().action_i
 *         else:
 *             offset = batch_index * ptr.get().action_size             # <<<<<<<<<<<<<<
 *             src_action_ptr = ptr.get().action_f
 *             memcpy(
 */
  __Pyx_TraceLine(1419,1,__PYX_ERR(0, 1419, __pyx_L1_error))
  /*else*/ {
    __pyx_v_offset = (__pyx_v_batch_index * __pyx_v_ptr.get()->action_size);

    /* "minari/dataset.pyx":1420
 *         else:
 *             offset = batch_index * ptr.get().action_size
 *             src_action_ptr = ptr.get().action_f             # <<<<<<<<<<<<<<
 *             memcpy(
 *                 (<FLOAT_t*> actions_ptr) + offset,
 */
    __Pyx_TraceLine(1420,1,__PYX_ERR(0, 1420, __pyx_L1_error))
    __pyx_t_3 = __pyx_v_ptr.get()->action_f;
    __pyx_v_src_action_ptr = __pyx_t_3;

    /* "minari/dataset.pyx":1421
 *             offset = batch_index * ptr.get().action_size
 *             src_action_ptr = ptr.get().action_f
 *             memcpy(             # <<<<<<<<<<<<<<
 *                 (<FLOAT_t*> actions_ptr) + offset,
 *                 <FLOAT_t*> src_action_ptr,
 */
    __Pyx_TraceLine(1421,1,__PYX_ERR(0, 1421, __pyx_L1_error))
    (void)(memcpy((((__pyx_t_6minari_7dataset_FLOAT_t *)__pyx_v_actions_ptr) + __pyx_v_offset), ((__pyx_t_6minari_7dataset_FLOAT_t *)__pyx_v_src_action_ptr), (__pyx_v_ptr.get()->action_size * (sizeof(__pyx_t_6minari_7dataset_FLOAT_t)))));
  }
  __pyx_L3:;

  /* "minari/dataset.pyx":1407
 *             )
 * 
 *     cdef void _assign_action(             # <<<<<<<<<<<<<<
 *         self,
 *         int batch_index,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("minari.dataset.TransitionMiniBatch._assign_action", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 1);
}

/* "minari/dataset.pyx":1427
 *             )
 * 
 *     cdef void _assign_to_batch(             # <<<<<<<<<<<<<<
 *         self,
 *         int batch_index,
 */

static void __pyx_f_6minari_7dataset_19TransitionMiniBatch__assign_to_batch(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self, int __pyx_v_batch_index, __pyx_t_6minari_7dataset_TransitionPtr __pyx_v_ptr, void *__pyx_v_observations_ptr, void *__pyx_v_actions_ptr, float *__pyx_v_rewards_ptr, void *__pyx_v_next_observations_ptr, float *__pyx_v_terminations_ptr, float *__pyx_v_truncations_ptr, float *__pyx_v_n_steps_ptr, int __pyx_v_n_frames, int __pyx_v_n_steps, float __pyx_v_gamma, bool __pyx_v_is_image, bool __pyx_v_is_discrete) {
  int __pyx_v_i;
  float __pyx_v_n_step_return;
  __pyx_t_6minari_7dataset_TransitionPtr __pyx_v_next_ptr;
  __Pyx_TraceDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  std::shared_ptr<minari::CTransition>  __pyx_t_6;
  float __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("_assign_to_batch", __pyx_f[0], 1427, 1, __PYX_ERR(0, 1427, __pyx_L1_error));

  /* "minari/dataset.pyx":1445
 *     ) nogil:
 *         cdef int i
 *         cdef float n_step_return = 0.0             # <<<<<<<<<<<<<<
 *         cdef TransitionPtr next_ptr
 * 
 */
  __Pyx_TraceLine(1445,1,__PYX_ERR(0, 1445, __pyx_L1_error))
  __pyx_v_n_step_return = 0.0;

  /* "minari/dataset.pyx":1449
 * 
 *         # assign data at t
 *         self._assign_observation(             # <<<<<<<<<<<<<<
 *             batch_index=batch_index,
 *             ptr=ptr,
 */
  __Pyx_TraceLine(1449,1,__PYX_ERR(0, 1449, __pyx_L1_error))
  ((struct __pyx_vtabstruct_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self->__pyx_vtab)->_assign_observation(__pyx_v_self, __pyx_v_batch_index, __pyx_v_ptr, __pyx_v_observations_ptr, __pyx_v_n_frames, __pyx_v_is_image, 0);

  /* "minari/dataset.pyx":1457
 *             is_next=False
 *         )
 *         self._assign_action(             # <<<<<<<<<<<<<<
 *             batch_index=batch_index,
 *             ptr=ptr,
 */
  __Pyx_TraceLine(1457,1,__PYX_ERR(0, 1457, __pyx_L1_error))
  ((struct __pyx_vtabstruct_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self->__pyx_vtab)->_assign_action(__pyx_v_self, __pyx_v_batch_index, __pyx_v_ptr, __pyx_v_actions_ptr, __pyx_v_is_discrete);

  /* "minari/dataset.pyx":1465
 * 
 *         # compute N-step return
 *         next_ptr = ptr             # <<<<<<<<<<<<<<
 *         for i in range(n_steps):
 *             n_step_return += next_ptr.get().reward * gamma ** i
 */
  __Pyx_TraceLine(1465,1,__PYX_ERR(0, 1465, __pyx_L1_error))
  __pyx_v_next_ptr = __pyx_v_ptr;

  /* "minari/dataset.pyx":1466
 *         # compute N-step return
 *         next_ptr = ptr
 *         for i in range(n_steps):             # <<<<<<<<<<<<<<
 *             n_step_return += next_ptr.get().reward * gamma ** i
 *             if next_ptr.get().next_transition == nullptr or i == n_steps - 1:
 */
  __Pyx_TraceLine(1466,1,__PYX_ERR(0, 1466, __pyx_L1_error))
  __pyx_t_1 = __pyx_v_n_steps;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "minari/dataset.pyx":1467
 *         next_ptr = ptr
 *         for i in range(n_steps):
 *             n_step_return += next_ptr.get().reward * gamma ** i             # <<<<<<<<<<<<<<
 *             if next_ptr.get().next_transition == nullptr or i == n_steps - 1:
 *                 break
 */
    __Pyx_TraceLine(1467,1,__PYX_ERR(0, 1467, __pyx_L1_error))
    __pyx_v_n_step_return = (__pyx_v_n_step_return + (__pyx_v_next_ptr.get()->reward * powf(__pyx_v_gamma, ((float)__pyx_v_i))));

    /* "minari/dataset.pyx":1468
 *         for i in range(n_steps):
 *             n_step_return += next_ptr.get().reward * gamma ** i
 *             if next_ptr.get().next_transition == nullptr or i == n_steps - 1:             # <<<<<<<<<<<<<<
 *                 break
 *             next_ptr = next_ptr.get().next_transition
 */
    __Pyx_TraceLine(1468,1,__PYX_ERR(0, 1468, __pyx_L1_error))
    __pyx_t_5 = ((__pyx_v_next_ptr.get()->next_transition == nullptr) != 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = ((__pyx_v_i == (__pyx_v_n_steps - 1)) != 0);
    __pyx_t_4 = __pyx_t_5;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_4) {

      /* "minari/dataset.pyx":1469
 *             n_step_return += next_ptr.get().reward * gamma ** i
 *             if next_ptr.get().next_transition == nullptr or i == n_steps - 1:
 *                 break             # <<<<<<<<<<<<<<
 *             next_ptr = next_ptr.get().next_transition
 * 
 */
      __Pyx_TraceLine(1469,1,__PYX_ERR(0, 1469, __pyx_L1_error))
      goto __pyx_L4_break;

      /* "minari/dataset.pyx":1468
 *         for i in range(n_steps):
 *             n_step_return += next_ptr.get().reward * gamma ** i
 *             if next_ptr.get().next_transition == nullptr or i == n_steps - 1:             # <<<<<<<<<<<<<<
 *                 break
 *             next_ptr = next_ptr.get().next_transition
 */
    }

    /* "minari/dataset.pyx":1470
 *             if next_ptr.get().next_transition == nullptr or i == n_steps - 1:
 *                 break
 *             next_ptr = next_ptr.get().next_transition             # <<<<<<<<<<<<<<
 * 
 *         rewards_ptr[batch_index] = n_step_return
 */
    __Pyx_TraceLine(1470,1,__PYX_ERR(0, 1470, __pyx_L1_error))
    __pyx_t_6 = __pyx_v_next_ptr.get()->next_transition;
    __pyx_v_next_ptr = __pyx_t_6;
  }
  __pyx_L4_break:;

  /* "minari/dataset.pyx":1472
 *             next_ptr = next_ptr.get().next_transition
 * 
 *         rewards_ptr[batch_index] = n_step_return             # <<<<<<<<<<<<<<
 * 
 *         # assign data at t+N
 */
  __Pyx_TraceLine(1472,1,__PYX_ERR(0, 1472, __pyx_L1_error))
  (__pyx_v_rewards_ptr[__pyx_v_batch_index]) = __pyx_v_n_step_return;

  /* "minari/dataset.pyx":1475
 * 
 *         # assign data at t+N
 *         self._assign_observation(             # <<<<<<<<<<<<<<
 *             batch_index=batch_index,
 *             ptr=next_ptr,
 */
  __Pyx_TraceLine(1475,1,__PYX_ERR(0, 1475, __pyx_L1_error))
  ((struct __pyx_vtabstruct_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self->__pyx_vtab)->_assign_observation(__pyx_v_self, __pyx_v_batch_index, __pyx_v_next_ptr, __pyx_v_next_observations_ptr, __pyx_v_n_frames, __pyx_v_is_image, 1);

  /* "minari/dataset.pyx":1483
 *             is_next=True
 *         )
 *         terminations_ptr[batch_index] = next_ptr.get().termination             # <<<<<<<<<<<<<<
 *         truncations_ptr[batch_index] = next_ptr.get().truncation  # todo: check if this is needed (I assume it is)
 *         n_steps_ptr[batch_index] = i + 1
 */
  __Pyx_TraceLine(1483,1,__PYX_ERR(0, 1483, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_next_ptr.get()->termination;
  (__pyx_v_terminations_ptr[__pyx_v_batch_index]) = __pyx_t_7;

  /* "minari/dataset.pyx":1484
 *         )
 *         terminations_ptr[batch_index] = next_ptr.get().termination
 *         truncations_ptr[batch_index] = next_ptr.get().truncation  # todo: check if this is needed (I assume it is)             # <<<<<<<<<<<<<<
 *         n_steps_ptr[batch_index] = i + 1
 * 
 */
  __Pyx_TraceLine(1484,1,__PYX_ERR(0, 1484, __pyx_L1_error))
  __pyx_t_7 = __pyx_v_next_ptr.get()->truncation;
  (__pyx_v_truncations_ptr[__pyx_v_batch_index]) = __pyx_t_7;

  /* "minari/dataset.pyx":1485
 *         terminations_ptr[batch_index] = next_ptr.get().termination
 *         truncations_ptr[batch_index] = next_ptr.get().truncation  # todo: check if this is needed (I assume it is)
 *         n_steps_ptr[batch_index] = i + 1             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1485,1,__PYX_ERR(0, 1485, __pyx_L1_error))
  (__pyx_v_n_steps_ptr[__pyx_v_batch_index]) = (__pyx_v_i + 1);

  /* "minari/dataset.pyx":1427
 *             )
 * 
 *     cdef void _assign_to_batch(             # <<<<<<<<<<<<<<
 *         self,
 *         int batch_index,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("minari.dataset.TransitionMiniBatch._assign_to_batch", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 1);
}

/* "minari/dataset.pyx":1488
 * 
 *     @property
 *     def observations(self):             # <<<<<<<<<<<<<<
 *         """ Returns mini-batch of observations at `t`.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_12observations_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_12observations_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_19TransitionMiniBatch_12observations___get__(((struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_12observations___get__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1488, 0, __PYX_ERR(0, 1488, __pyx_L1_error));

  /* "minari/dataset.pyx":1495
 * 
 *         """
 *         return self._observations             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1495,0,__PYX_ERR(0, 1495, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_observations));
  __pyx_r = ((PyObject *)__pyx_v_self->_observations);
  goto __pyx_L0;

  /* "minari/dataset.pyx":1488
 * 
 *     @property
 *     def observations(self):             # <<<<<<<<<<<<<<
 *         """ Returns mini-batch of observations at `t`.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("minari.dataset.TransitionMiniBatch.observations.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1498
 * 
 *     @property
 *     def actions(self):             # <<<<<<<<<<<<<<
 *         """ Returns mini-batch of actions at `t`.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_7actions_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_7actions_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_19TransitionMiniBatch_7actions___get__(((struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_7actions___get__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1498, 0, __PYX_ERR(0, 1498, __pyx_L1_error));

  /* "minari/dataset.pyx":1505
 * 
 *         """
 *         return self._actions             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1505,0,__PYX_ERR(0, 1505, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_actions));
  __pyx_r = ((PyObject *)__pyx_v_self->_actions);
  goto __pyx_L0;

  /* "minari/dataset.pyx":1498
 * 
 *     @property
 *     def actions(self):             # <<<<<<<<<<<<<<
 *         """ Returns mini-batch of actions at `t`.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("minari.dataset.TransitionMiniBatch.actions.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1508
 * 
 *     @property
 *     def rewards(self):             # <<<<<<<<<<<<<<
 *         """ Returns mini-batch of rewards at `t`.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_7rewards_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_7rewards_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_19TransitionMiniBatch_7rewards___get__(((struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_7rewards___get__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1508, 0, __PYX_ERR(0, 1508, __pyx_L1_error));

  /* "minari/dataset.pyx":1515
 * 
 *         """
 *         return self._rewards             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1515,0,__PYX_ERR(0, 1515, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_rewards));
  __pyx_r = ((PyObject *)__pyx_v_self->_rewards);
  goto __pyx_L0;

  /* "minari/dataset.pyx":1508
 * 
 *     @property
 *     def rewards(self):             # <<<<<<<<<<<<<<
 *         """ Returns mini-batch of rewards at `t`.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("minari.dataset.TransitionMiniBatch.rewards.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1518
 * 
 *     @property
 *     def next_observations(self):             # <<<<<<<<<<<<<<
 *         """ Returns mini-batch of observations at `t+n`.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_17next_observations_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_17next_observations_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_19TransitionMiniBatch_17next_observations___get__(((struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_17next_observations___get__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1518, 0, __PYX_ERR(0, 1518, __pyx_L1_error));

  /* "minari/dataset.pyx":1525
 * 
 *         """
 *         return self._next_observations             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1525,0,__PYX_ERR(0, 1525, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_next_observations));
  __pyx_r = ((PyObject *)__pyx_v_self->_next_observations);
  goto __pyx_L0;

  /* "minari/dataset.pyx":1518
 * 
 *     @property
 *     def next_observations(self):             # <<<<<<<<<<<<<<
 *         """ Returns mini-batch of observations at `t+n`.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("minari.dataset.TransitionMiniBatch.next_observations.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1528
 * 
 *     @property
 *     def terminations(self):             # <<<<<<<<<<<<<<
 *         """ Returns mini-batch of terminal flags at `t+n`.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_12terminations_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_12terminations_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_19TransitionMiniBatch_12terminations___get__(((struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_12terminations___get__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1528, 0, __PYX_ERR(0, 1528, __pyx_L1_error));

  /* "minari/dataset.pyx":1535
 * 
 *         """
 *         return self._terminations             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1535,0,__PYX_ERR(0, 1535, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_terminations));
  __pyx_r = ((PyObject *)__pyx_v_self->_terminations);
  goto __pyx_L0;

  /* "minari/dataset.pyx":1528
 * 
 *     @property
 *     def terminations(self):             # <<<<<<<<<<<<<<
 *         """ Returns mini-batch of terminal flags at `t+n`.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("minari.dataset.TransitionMiniBatch.terminations.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1538
 * 
 *     @property
 *     def truncations(self):             # <<<<<<<<<<<<<<
 *         """ Returns mini-batch of terminal flags at `t+n`.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_11truncations_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_11truncations_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_19TransitionMiniBatch_11truncations___get__(((struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_11truncations___get__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1538, 0, __PYX_ERR(0, 1538, __pyx_L1_error));

  /* "minari/dataset.pyx":1545
 * 
 *         """
 *         return self._truncations             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1545,0,__PYX_ERR(0, 1545, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_truncations));
  __pyx_r = ((PyObject *)__pyx_v_self->_truncations);
  goto __pyx_L0;

  /* "minari/dataset.pyx":1538
 * 
 *     @property
 *     def truncations(self):             # <<<<<<<<<<<<<<
 *         """ Returns mini-batch of terminal flags at `t+n`.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("minari.dataset.TransitionMiniBatch.truncations.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1548
 * 
 *     @property
 *     def n_steps(self):             # <<<<<<<<<<<<<<
 *         """ Returns mini-batch of the number of steps before next observations.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_7n_steps_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_7n_steps_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_19TransitionMiniBatch_7n_steps___get__(((struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_7n_steps___get__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1548, 0, __PYX_ERR(0, 1548, __pyx_L1_error));

  /* "minari/dataset.pyx":1558
 * 
 *         """
 *         return self._n_steps             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_TraceLine(1558,0,__PYX_ERR(0, 1558, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_n_steps));
  __pyx_r = ((PyObject *)__pyx_v_self->_n_steps);
  goto __pyx_L0;

  /* "minari/dataset.pyx":1548
 * 
 *     @property
 *     def n_steps(self):             # <<<<<<<<<<<<<<
 *         """ Returns mini-batch of the number of steps before next observations.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("minari.dataset.TransitionMiniBatch.n_steps.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1561
 * 
 *     @property
 *     def transitions(self):             # <<<<<<<<<<<<<<
 *         """ Returns transitions.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_11transitions_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_11transitions_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_19TransitionMiniBatch_11transitions___get__(((struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_11transitions___get__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceCall("__get__", __pyx_f[0], 1561, 0, __PYX_ERR(0, 1561, __pyx_L1_error));

  /* "minari/dataset.pyx":1568
 * 
 *         """
 *         return self._transitions             # <<<<<<<<<<<<<<
 * 
 *     def size(self):
 */
  __Pyx_TraceLine(1568,0,__PYX_ERR(0, 1568, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_transitions);
  __pyx_r = __pyx_v_self->_transitions;
  goto __pyx_L0;

  /* "minari/dataset.pyx":1561
 * 
 *     @property
 *     def transitions(self):             # <<<<<<<<<<<<<<
 *         """ Returns transitions.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("minari.dataset.TransitionMiniBatch.transitions.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1570
 *         return self._transitions
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         """ Returns size of mini-batch.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_3size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6minari_7dataset_19TransitionMiniBatch_2size[] = " Returns size of mini-batch.\n\n        Returns:\n            int: mini-batch size.\n\n        ";
static PyMethodDef __pyx_mdef_6minari_7dataset_19TransitionMiniBatch_3size = {"size", (PyCFunction)__pyx_pw_6minari_7dataset_19TransitionMiniBatch_3size, METH_NOARGS, __pyx_doc_6minari_7dataset_19TransitionMiniBatch_2size};
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_3size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("size (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_19TransitionMiniBatch_2size(((struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_2size(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__81)
  __Pyx_RefNannySetupContext("size", 0);
  __Pyx_TraceCall("size", __pyx_f[0], 1570, 0, __PYX_ERR(0, 1570, __pyx_L1_error));

  /* "minari/dataset.pyx":1577
 * 
 *         """
 *         return len(self._transitions)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_TraceLine(1577,0,__PYX_ERR(0, 1577, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->_transitions;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 1577, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1577, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":1570
 *         return self._transitions
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         """ Returns size of mini-batch.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.TransitionMiniBatch.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1579
 *         return len(self._transitions)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size()
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_6minari_7dataset_19TransitionMiniBatch_5__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_6minari_7dataset_19TransitionMiniBatch_5__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_19TransitionMiniBatch_4__len__(((struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_6minari_7dataset_19TransitionMiniBatch_4__len__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 0);
  __Pyx_TraceCall("__len__", __pyx_f[0], 1579, 0, __PYX_ERR(0, 1579, __pyx_L1_error));

  /* "minari/dataset.pyx":1580
 * 
 *     def __len__(self):
 *         return self.size()             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, index):
 */
  __Pyx_TraceLine(1580,0,__PYX_ERR(0, 1580, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1580, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  /* "minari/dataset.pyx":1579
 *         return len(self._transitions)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("minari.dataset.TransitionMiniBatch.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1582
 *         return self.size()
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         return self._transitions[index]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_19TransitionMiniBatch_6__getitem__(((struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self), ((PyObject *)__pyx_v_index));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_6__getitem__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceCall("__getitem__", __pyx_f[0], 1582, 0, __PYX_ERR(0, 1582, __pyx_L1_error));

  /* "minari/dataset.pyx":1583
 * 
 *     def __getitem__(self, index):
 *         return self._transitions[index]             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_TraceLine(1583,0,__PYX_ERR(0, 1583, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_self->_transitions == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1583, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_self->_transitions, __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":1582
 *         return self.size()
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         return self._transitions[index]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.TransitionMiniBatch.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "minari/dataset.pyx":1585
 *         return self._transitions[index]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self._transitions)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_9__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_9__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_19TransitionMiniBatch_8__iter__(((struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_8__iter__(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __Pyx_TraceCall("__iter__", __pyx_f[0], 1585, 0, __PYX_ERR(0, 1585, __pyx_L1_error));

  /* "minari/dataset.pyx":1586
 * 
 *     def __iter__(self):
 *         return iter(self._transitions)             # <<<<<<<<<<<<<<
 */
  __Pyx_TraceLine(1586,0,__PYX_ERR(0, 1586, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->_transitions;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "minari/dataset.pyx":1585
 *         return self._transitions[index]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self._transitions)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("minari.dataset.TransitionMiniBatch.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_19TransitionMiniBatch_11__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw_6minari_7dataset_19TransitionMiniBatch_11__reduce_cython__, METH_NOARGS, 0};
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_19TransitionMiniBatch_10__reduce_cython__(((struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__82)
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceCall("__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __Pyx_TraceLine(2,0,__PYX_ERR(1, 2, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__83, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.TransitionMiniBatch.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyMethodDef __pyx_mdef_6minari_7dataset_19TransitionMiniBatch_13__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw_6minari_7dataset_19TransitionMiniBatch_13__setstate_cython__, METH_O, 0};
static PyObject *__pyx_pw_6minari_7dataset_19TransitionMiniBatch_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6minari_7dataset_19TransitionMiniBatch_12__setstate_cython__(((struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6minari_7dataset_19TransitionMiniBatch_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(__pyx_codeobj__84)
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceCall("__setstate_cython__", __pyx_f[1], 3, 0, __PYX_ERR(1, 3, __pyx_L1_error));

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __Pyx_TraceLine(4,0,__PYX_ERR(1, 4, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__85, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("minari.dataset.TransitionMiniBatch.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":734
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
  __Pyx_TraceCall("PyArray_MultiIterNew1", __pyx_f[2], 734, 0, __PYX_ERR(2, 734, __pyx_L1_error));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":735
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 */
  __Pyx_TraceLine(735,0,__PYX_ERR(2, 735, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":734
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":737
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
  __Pyx_TraceCall("PyArray_MultiIterNew2", __pyx_f[2], 737, 0, __PYX_ERR(2, 737, __pyx_L1_error));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":738
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 */
  __Pyx_TraceLine(738,0,__PYX_ERR(2, 738, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":737
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":740
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
  __Pyx_TraceCall("PyArray_MultiIterNew3", __pyx_f[2], 740, 0, __PYX_ERR(2, 740, __pyx_L1_error));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":741
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 */
  __Pyx_TraceLine(741,0,__PYX_ERR(2, 741, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":740
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":743
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
  __Pyx_TraceCall("PyArray_MultiIterNew4", __pyx_f[2], 743, 0, __PYX_ERR(2, 743, __pyx_L1_error));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":744
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 */
  __Pyx_TraceLine(744,0,__PYX_ERR(2, 744, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":743
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":746
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
  __Pyx_TraceCall("PyArray_MultiIterNew5", __pyx_f[2], 746, 0, __PYX_ERR(2, 746, __pyx_L1_error));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":747
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 */
  __Pyx_TraceLine(747,0,__PYX_ERR(2, 747, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":746
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":749
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
  __Pyx_TraceCall("PyDataType_SHAPE", __pyx_f[2], 749, 0, __PYX_ERR(2, 749, __pyx_L1_error));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":750
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
 */
  __Pyx_TraceLine(750,0,__PYX_ERR(2, 750, __pyx_L1_error))
  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
  if (__pyx_t_1) {

    /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":751
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
 *     else:
 *         return ()
 */
    __Pyx_TraceLine(751,0,__PYX_ERR(2, 751, __pyx_L1_error))
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
    __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
    goto __pyx_L0;

    /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":750
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
 */
  }

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":753
 *         return <tuple>d.subarray.shape
 *     else:
 *         return ()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_TraceLine(753,0,__PYX_ERR(2, 753, __pyx_L1_error))
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    goto __pyx_L0;
  }

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":749
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("numpy.PyDataType_SHAPE", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":928
 *     int _import_umath() except -1
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)
 */

static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_array_base", 0);
  __Pyx_TraceCall("set_array_base", __pyx_f[2], 928, 0, __PYX_ERR(2, 928, __pyx_L1_error));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":929
 * 
 * cdef inline void set_array_base(ndarray arr, object base):
 *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
 *     PyArray_SetBaseObject(arr, base)
 * 
 */
  __Pyx_TraceLine(929,0,__PYX_ERR(2, 929, __pyx_L1_error))
  Py_INCREF(__pyx_v_base);

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":930
 * cdef inline void set_array_base(ndarray arr, object base):
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
 */
  __Pyx_TraceLine(930,0,__PYX_ERR(2, 930, __pyx_L1_error))
  (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":928
 *     int _import_umath() except -1
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
}

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":932
 *     PyArray_SetBaseObject(arr, base)
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     base = PyArray_BASE(arr)
 *     if base is NULL:
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  PyObject *__pyx_v_base;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_array_base", 0);
  __Pyx_TraceCall("get_array_base", __pyx_f[2], 932, 0, __PYX_ERR(2, 932, __pyx_L1_error));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":933
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
 *     if base is NULL:
 *         return None
 */
  __Pyx_TraceLine(933,0,__PYX_ERR(2, 933, __pyx_L1_error))
  __pyx_v_base = PyArray_BASE(__pyx_v_arr);

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":934
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)
 *     if base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return <object>base
 */
  __Pyx_TraceLine(934,0,__PYX_ERR(2, 934, __pyx_L1_error))
  __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
  if (__pyx_t_1) {

    /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":935
 *     base = PyArray_BASE(arr)
 *     if base is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     return <object>base
 * 
 */
    __Pyx_TraceLine(935,0,__PYX_ERR(2, 935, __pyx_L1_error))
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":934
 * cdef inline object get_array_base(ndarray arr):
 *     base = PyArray_BASE(arr)
 *     if base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     return <object>base
 */
  }

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":936
 *     if base is NULL:
 *         return None
 *     return <object>base             # <<<<<<<<<<<<<<
 * 
 * # Versions of the import_* functions which are more suitable for
 */
  __Pyx_TraceLine(936,0,__PYX_ERR(2, 936, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_base));
  __pyx_r = ((PyObject *)__pyx_v_base);
  goto __pyx_L0;

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":932
 *     PyArray_SetBaseObject(arr, base)
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     base = PyArray_BASE(arr)
 *     if base is NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("numpy.get_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":940
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         __pyx_import_array()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("import_array", 0);
  __Pyx_TraceCall("import_array", __pyx_f[2], 940, 0, __PYX_ERR(2, 940, __pyx_L1_error));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":941
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         __pyx_import_array()
 *     except Exception:
 */
  __Pyx_TraceLine(941,0,__PYX_ERR(2, 941, __pyx_L1_error))
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":942
 * cdef inline int import_array() except -1:
 *     try:
 *         __pyx_import_array()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")
 */
      __Pyx_TraceLine(942,0,__PYX_ERR(2, 942, __pyx_L3_error))
      __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 942, __pyx_L3_error)

      /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":941
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         __pyx_import_array()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":943
 *     try:
 *         __pyx_import_array()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 */
    __Pyx_TraceLine(943,0,__PYX_ERR(2, 943, __pyx_L5_except_error))
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 943, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":944
 *         __pyx_import_array()
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
 */
      __Pyx_TraceLine(944,0,__PYX_ERR(2, 944, __pyx_L5_except_error))
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__86, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 944, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(2, 944, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":941
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         __pyx_import_array()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":940
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         __pyx_import_array()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":946
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("import_umath", 0);
  __Pyx_TraceCall("import_umath", __pyx_f[2], 946, 0, __PYX_ERR(2, 946, __pyx_L1_error));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":947
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
  __Pyx_TraceLine(947,0,__PYX_ERR(2, 947, __pyx_L1_error))
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":948
 * cdef inline int import_umath() except -1:
 *     try:
 *         _import_umath()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")
 */
      __Pyx_TraceLine(948,0,__PYX_ERR(2, 948, __pyx_L3_error))
      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 948, __pyx_L3_error)

      /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":947
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":949
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 */
    __Pyx_TraceLine(949,0,__PYX_ERR(2, 949, __pyx_L5_except_error))
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 949, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":950
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
 */
      __Pyx_TraceLine(950,0,__PYX_ERR(2, 950, __pyx_L5_except_error))
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__87, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 950, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(2, 950, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":947
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":946
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":952
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("import_ufunc", 0);
  __Pyx_TraceCall("import_ufunc", __pyx_f[2], 952, 0, __PYX_ERR(2, 952, __pyx_L1_error));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":953
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
  __Pyx_TraceLine(953,0,__PYX_ERR(2, 953, __pyx_L1_error))
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":954
 * cdef inline int import_ufunc() except -1:
 *     try:
 *         _import_umath()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")
 */
      __Pyx_TraceLine(954,0,__PYX_ERR(2, 954, __pyx_L3_error))
      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 954, __pyx_L3_error)

      /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":953
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":955
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 */
    __Pyx_TraceLine(955,0,__PYX_ERR(2, 955, __pyx_L5_except_error))
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 955, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":956
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef extern from *:
 */
      __Pyx_TraceLine(956,0,__PYX_ERR(2, 956, __pyx_L5_except_error))
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__87, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 956, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(2, 956, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":953
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":952
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":966
 * 
 * 
 * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.timedelta64)`
 */

static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_timedelta64_object", 0);
  __Pyx_TraceCall("is_timedelta64_object", __pyx_f[2], 966, 0, __PYX_ERR(2, 966, __pyx_L1_error));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":978
 *     bool
 *     """
 *     return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_TraceLine(978,0,__PYX_ERR(2, 978, __pyx_L1_error))
  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
  goto __pyx_L0;

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":966
 * 
 * 
 * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.timedelta64)`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("numpy.is_timedelta64_object", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":981
 * 
 * 
 * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.datetime64)`
 */

static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_datetime64_object", 0);
  __Pyx_TraceCall("is_datetime64_object", __pyx_f[2], 981, 0, __PYX_ERR(2, 981, __pyx_L1_error));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":993
 *     bool
 *     """
 *     return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_TraceLine(993,0,__PYX_ERR(2, 993, __pyx_L1_error))
  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
  goto __pyx_L0;

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":981
 * 
 * 
 * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.datetime64)`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("numpy.is_datetime64_object", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":996
 * 
 * 
 * cdef inline npy_datetime get_datetime64_value(object obj) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the int64 value underlying scalar numpy datetime64 object
 */

static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
  npy_datetime __pyx_r;
  __Pyx_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("get_datetime64_value", __pyx_f[2], 996, 1, __PYX_ERR(2, 996, __pyx_L1_error));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":1003
 *     also needed.  That can be found using `get_datetime64_unit`.
 *     """
 *     return (<PyDatetimeScalarObject*>obj).obval             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_TraceLine(1003,1,__PYX_ERR(2, 1003, __pyx_L1_error))
  __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
  goto __pyx_L0;

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":996
 * 
 * 
 * cdef inline npy_datetime get_datetime64_value(object obj) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the int64 value underlying scalar numpy datetime64 object
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("numpy.get_datetime64_value", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 1);
  return __pyx_r;
}

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":1006
 * 
 * 
 * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the int64 value underlying scalar numpy timedelta64 object
 */

static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
  npy_timedelta __pyx_r;
  __Pyx_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("get_timedelta64_value", __pyx_f[2], 1006, 1, __PYX_ERR(2, 1006, __pyx_L1_error));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":1010
 *     returns the int64 value underlying scalar numpy timedelta64 object
 *     """
 *     return (<PyTimedeltaScalarObject*>obj).obval             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_TraceLine(1010,1,__PYX_ERR(2, 1010, __pyx_L1_error))
  __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
  goto __pyx_L0;

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":1006
 * 
 * 
 * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the int64 value underlying scalar numpy timedelta64 object
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("numpy.get_timedelta64_value", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 1);
  return __pyx_r;
}

/* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":1013
 * 
 * 
 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the unit part of the dtype for a numpy datetime64 object.
 */

static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
  NPY_DATETIMEUNIT __pyx_r;
  __Pyx_TraceDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceCall("get_datetime64_unit", __pyx_f[2], 1013, 1, __PYX_ERR(2, 1013, __pyx_L1_error));

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":1017
 *     returns the unit part of the dtype for a numpy datetime64 object.
 *     """
 *     return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base             # <<<<<<<<<<<<<<
 */
  __Pyx_TraceLine(1017,1,__PYX_ERR(2, 1017, __pyx_L1_error))
  __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
  goto __pyx_L0;

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":1013
 * 
 * 
 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the unit part of the dtype for a numpy datetime64 object.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("numpy.get_datetime64_unit", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
  __pyx_r = (NPY_DATETIMEUNIT) 0;
  __pyx_L0:;
  __Pyx_TraceReturn(Py_None, 1);
  return __pyx_r;
}

/* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_int")
 * cdef vector[X] __pyx_convert_vector_from_py_int(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

static std::vector<int>  __pyx_convert_vector_from_py_int(PyObject *__pyx_v_o) {
  std::vector<int>  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<int>  __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_int", 0);
  __Pyx_TraceCall("__pyx_convert_vector_from_py_int", __pyx_f[1], 45, 0, __PYX_ERR(1, 45, __pyx_L1_error));

  /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_int(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
  __Pyx_TraceLine(47,0,__PYX_ERR(1, 47, __pyx_L1_error))
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 47, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(1, 47, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":48
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(<X>item)             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __Pyx_TraceLine(48,0,__PYX_ERR(1, 48, __pyx_L1_error))
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_item); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error)
    __pyx_v_v.push_back(((int)__pyx_t_5));

    /* "vector.from_py":47
 * cdef vector[X] __pyx_convert_vector_from_py_int(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(<X>item)
 *     return v
 */
    __Pyx_TraceLine(47,0,__PYX_ERR(1, 47, __pyx_L1_error))
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":49
 *     for item in o:
 *         v.push_back(<X>item)
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_TraceLine(49,0,__PYX_ERR(1, 49, __pyx_L1_error))
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_int")
 * cdef vector[X] __pyx_convert_vector_from_py_int(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_pretend_to_initialize(&__pyx_r);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_TraceReturn(Py_None, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_int")
 * cdef object __pyx_convert_vector_to_py_int(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_int(const std::vector<int>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_int", 0);
  __Pyx_TraceCall("__pyx_convert_vector_to_py_int", __pyx_f[1], 60, 0, __PYX_ERR(1, 60, __pyx_L1_error));

  /* "vector.to_py":61
 * @cname("__pyx_convert_vector_to_py_int")
 * cdef object __pyx_convert_vector_to_py_int(vector[X]& v):
 *     return [v[i] for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_TraceLine(61,0,__PYX_ERR(1, 61, __pyx_L1_error))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;
    __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_int")
 * cdef object __pyx_convert_vector_to_py_int(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_6minari_7dataset_Transition __pyx_vtable_6minari_7dataset_Transition;

static PyObject *__pyx_tp_new_6minari_7dataset_Transition(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6minari_7dataset_Transition *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6minari_7dataset_Transition *)o);
  p->__pyx_vtab = __pyx_vtabptr_6minari_7dataset_Transition;
  new((void*)&(p->_thisptr)) __pyx_t_6minari_7dataset_TransitionPtr();
  p->_observation = Py_None; Py_INCREF(Py_None);
  p->_action = Py_None; Py_INCREF(Py_None);
  p->_next_observation = Py_None; Py_INCREF(Py_None);
  p->_prev_transition = ((struct __pyx_obj_6minari_7dataset_Transition *)Py_None); Py_INCREF(Py_None);
  p->_next_transition = ((struct __pyx_obj_6minari_7dataset_Transition *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_6minari_7dataset_10Transition_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6minari_7dataset_Transition(PyObject *o) {
  struct __pyx_obj_6minari_7dataset_Transition *p = (struct __pyx_obj_6minari_7dataset_Transition *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  __Pyx_call_destructor(p->_thisptr);
  Py_CLEAR(p->_observation);
  Py_CLEAR(p->_action);
  Py_CLEAR(p->_next_observation);
  Py_CLEAR(p->_prev_transition);
  Py_CLEAR(p->_next_transition);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6minari_7dataset_Transition(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6minari_7dataset_Transition *p = (struct __pyx_obj_6minari_7dataset_Transition *)o;
  if (p->_observation) {
    e = (*v)(p->_observation, a); if (e) return e;
  }
  if (p->_action) {
    e = (*v)(p->_action, a); if (e) return e;
  }
  if (p->_next_observation) {
    e = (*v)(p->_next_observation, a); if (e) return e;
  }
  if (p->_prev_transition) {
    e = (*v)(((PyObject *)p->_prev_transition), a); if (e) return e;
  }
  if (p->_next_transition) {
    e = (*v)(((PyObject *)p->_next_transition), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6minari_7dataset_Transition(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6minari_7dataset_Transition *p = (struct __pyx_obj_6minari_7dataset_Transition *)o;
  tmp = ((PyObject*)p->_observation);
  p->_observation = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_action);
  p->_action = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_next_observation);
  p->_next_observation = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_prev_transition);
  p->_prev_transition = ((struct __pyx_obj_6minari_7dataset_Transition *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_next_transition);
  p->_next_transition = ((struct __pyx_obj_6minari_7dataset_Transition *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6minari_7dataset_10Transition_is_discrete(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_10Transition_11is_discrete_1__get__(o);
}

static PyObject *__pyx_getprop_6minari_7dataset_10Transition_observation(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_10Transition_11observation_1__get__(o);
}

static PyObject *__pyx_getprop_6minari_7dataset_10Transition_action(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_10Transition_6action_1__get__(o);
}

static PyObject *__pyx_getprop_6minari_7dataset_10Transition_reward(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_10Transition_6reward_1__get__(o);
}

static PyObject *__pyx_getprop_6minari_7dataset_10Transition_next_observation(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_10Transition_16next_observation_1__get__(o);
}

static PyObject *__pyx_getprop_6minari_7dataset_10Transition_termination(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_10Transition_11termination_1__get__(o);
}

static PyObject *__pyx_getprop_6minari_7dataset_10Transition_truncation(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_10Transition_10truncation_1__get__(o);
}

static PyObject *__pyx_getprop_6minari_7dataset_10Transition_prev_transition(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_10Transition_15prev_transition_1__get__(o);
}

static int __pyx_setprop_6minari_7dataset_10Transition_prev_transition(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6minari_7dataset_10Transition_15prev_transition_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6minari_7dataset_10Transition_next_transition(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_10Transition_15next_transition_1__get__(o);
}

static int __pyx_setprop_6minari_7dataset_10Transition_next_transition(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6minari_7dataset_10Transition_15next_transition_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_6minari_7dataset_Transition[] = {
  {"get_observation_shape", (PyCFunction)__pyx_pw_6minari_7dataset_10Transition_3get_observation_shape, METH_NOARGS, __pyx_doc_6minari_7dataset_10Transition_2get_observation_shape},
  {"get_action_size", (PyCFunction)__pyx_pw_6minari_7dataset_10Transition_5get_action_size, METH_NOARGS, __pyx_doc_6minari_7dataset_10Transition_4get_action_size},
  {"clear_links", (PyCFunction)__pyx_pw_6minari_7dataset_10Transition_7clear_links, METH_NOARGS, __pyx_doc_6minari_7dataset_10Transition_6clear_links},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6minari_7dataset_10Transition_9__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6minari_7dataset_10Transition_11__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6minari_7dataset_Transition[] = {
  {(char *)"is_discrete", __pyx_getprop_6minari_7dataset_10Transition_is_discrete, 0, (char *)"Returns flag of discrete action-space.\n\n        Returns:\n            bool: ``True`` if action-space is discrete.\n\n        ", 0},
  {(char *)"observation", __pyx_getprop_6minari_7dataset_10Transition_observation, 0, (char *)" Returns observation at `t`.\n\n        Returns:\n            numpy.ndarray or torch.Tensor: observation at `t`.\n\n        ", 0},
  {(char *)"action", __pyx_getprop_6minari_7dataset_10Transition_action, 0, (char *)" Returns action at `t`.\n\n        Returns:\n            (numpy.ndarray or int): action at `t`.\n\n        ", 0},
  {(char *)"reward", __pyx_getprop_6minari_7dataset_10Transition_reward, 0, (char *)" Returns reward at `t`.\n\n        Returns:\n            float: reward at `t`.\n\n        ", 0},
  {(char *)"next_observation", __pyx_getprop_6minari_7dataset_10Transition_next_observation, 0, (char *)" Returns observation at `t+1`.\n\n        Returns:\n            numpy.ndarray or torch.Tensor: observation at `t+1`.\n\n        ", 0},
  {(char *)"termination", __pyx_getprop_6minari_7dataset_10Transition_termination, 0, (char *)" Returns termination flag at `t+1`.\n\n        Returns:\n            int: termination flag at `t+1`.\n\n        ", 0},
  {(char *)"truncation", __pyx_getprop_6minari_7dataset_10Transition_truncation, 0, (char *)" Returns truncation flag at `t+1`.\n\n        Returns:\n            int: truncation flag at `t+1`.\n\n        ", 0},
  {(char *)"prev_transition", __pyx_getprop_6minari_7dataset_10Transition_prev_transition, __pyx_setprop_6minari_7dataset_10Transition_prev_transition, (char *)" Returns pointer to the previous transition.\n\n        If this is the first transition, this method should return ``None``.\n\n        Returns:\n            minari.dataset.Transition: previous transition.\n\n        ", 0},
  {(char *)"next_transition", __pyx_getprop_6minari_7dataset_10Transition_next_transition, __pyx_setprop_6minari_7dataset_10Transition_next_transition, (char *)" Returns pointer to the next transition.\n\n        If this is the last transition, this method should return ``None``.\n\n        Returns:\n            minari.dataset.Transition: next transition.\n\n        ", 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_6minari_7dataset_Transition = {
  PyVarObject_HEAD_INIT(0, 0)
  "minari.dataset.Transition", /*tp_name*/
  sizeof(struct __pyx_obj_6minari_7dataset_Transition), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6minari_7dataset_Transition, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  " Transition class.\n\n    This class is designed to hold data between two time steps, which is\n    usually used as inputs of loss calculation in reinforcement learning.\n\n    Args:\n        observation_shape (tuple): observation shape.\n        action_size (int): dimension of action-space.\n        observation (numpy.ndarray): observation at `t`.\n        action (numpy.ndarray or int): action at `t`.\n        reward (float): reward at `t`.\n        next_observation (numpy.ndarray): observation at `t+1`.\n        terminal (int): terminal flag at `t+1`.\n        prev_transition (minari.dataset.Transition):\n            pointer to the previous transition.\n        next_transition (minari.dataset.Transition):\n            pointer to the next transition.\n\n    ", /*tp_doc*/
  __pyx_tp_traverse_6minari_7dataset_Transition, /*tp_traverse*/
  __pyx_tp_clear_6minari_7dataset_Transition, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6minari_7dataset_Transition, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6minari_7dataset_Transition, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6minari_7dataset_Transition, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};
static struct __pyx_vtabstruct_6minari_7dataset_TransitionMiniBatch __pyx_vtable_6minari_7dataset_TransitionMiniBatch;

static PyObject *__pyx_tp_new_6minari_7dataset_TransitionMiniBatch(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)o);
  p->__pyx_vtab = __pyx_vtabptr_6minari_7dataset_TransitionMiniBatch;
  p->_transitions = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_observations = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->_actions = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->_rewards = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->_next_observations = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->_terminations = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->_truncations = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->_n_steps = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_6minari_7dataset_19TransitionMiniBatch_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6minari_7dataset_TransitionMiniBatch(PyObject *o) {
  struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *p = (struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_transitions);
  Py_CLEAR(p->_observations);
  Py_CLEAR(p->_actions);
  Py_CLEAR(p->_rewards);
  Py_CLEAR(p->_next_observations);
  Py_CLEAR(p->_terminations);
  Py_CLEAR(p->_truncations);
  Py_CLEAR(p->_n_steps);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6minari_7dataset_TransitionMiniBatch(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *p = (struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)o;
  if (p->_transitions) {
    e = (*v)(p->_transitions, a); if (e) return e;
  }
  if (p->_observations) {
    e = (*v)(((PyObject *)p->_observations), a); if (e) return e;
  }
  if (p->_actions) {
    e = (*v)(((PyObject *)p->_actions), a); if (e) return e;
  }
  if (p->_rewards) {
    e = (*v)(((PyObject *)p->_rewards), a); if (e) return e;
  }
  if (p->_next_observations) {
    e = (*v)(((PyObject *)p->_next_observations), a); if (e) return e;
  }
  if (p->_terminations) {
    e = (*v)(((PyObject *)p->_terminations), a); if (e) return e;
  }
  if (p->_truncations) {
    e = (*v)(((PyObject *)p->_truncations), a); if (e) return e;
  }
  if (p->_n_steps) {
    e = (*v)(((PyObject *)p->_n_steps), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6minari_7dataset_TransitionMiniBatch(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *p = (struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *)o;
  tmp = ((PyObject*)p->_transitions);
  p->_transitions = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_observations);
  p->_observations = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_actions);
  p->_actions = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_rewards);
  p->_rewards = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_next_observations);
  p->_next_observations = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_terminations);
  p->_terminations = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_truncations);
  p->_truncations = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_n_steps);
  p->_n_steps = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_6minari_7dataset_TransitionMiniBatch(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyObject *__pyx_getprop_6minari_7dataset_19TransitionMiniBatch_observations(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_19TransitionMiniBatch_12observations_1__get__(o);
}

static PyObject *__pyx_getprop_6minari_7dataset_19TransitionMiniBatch_actions(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_19TransitionMiniBatch_7actions_1__get__(o);
}

static PyObject *__pyx_getprop_6minari_7dataset_19TransitionMiniBatch_rewards(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_19TransitionMiniBatch_7rewards_1__get__(o);
}

static PyObject *__pyx_getprop_6minari_7dataset_19TransitionMiniBatch_next_observations(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_19TransitionMiniBatch_17next_observations_1__get__(o);
}

static PyObject *__pyx_getprop_6minari_7dataset_19TransitionMiniBatch_terminations(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_19TransitionMiniBatch_12terminations_1__get__(o);
}

static PyObject *__pyx_getprop_6minari_7dataset_19TransitionMiniBatch_truncations(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_19TransitionMiniBatch_11truncations_1__get__(o);
}

static PyObject *__pyx_getprop_6minari_7dataset_19TransitionMiniBatch_n_steps(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_19TransitionMiniBatch_7n_steps_1__get__(o);
}

static PyObject *__pyx_getprop_6minari_7dataset_19TransitionMiniBatch_transitions(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6minari_7dataset_19TransitionMiniBatch_11transitions_1__get__(o);
}

static PyMethodDef __pyx_methods_6minari_7dataset_TransitionMiniBatch[] = {
  {"size", (PyCFunction)__pyx_pw_6minari_7dataset_19TransitionMiniBatch_3size, METH_NOARGS, __pyx_doc_6minari_7dataset_19TransitionMiniBatch_2size},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6minari_7dataset_19TransitionMiniBatch_11__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6minari_7dataset_19TransitionMiniBatch_13__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6minari_7dataset_TransitionMiniBatch[] = {
  {(char *)"observations", __pyx_getprop_6minari_7dataset_19TransitionMiniBatch_observations, 0, (char *)" Returns mini-batch of observations at `t`.\n\n        Returns:\n            numpy.ndarray or torch.Tensor: observations at `t`.\n\n        ", 0},
  {(char *)"actions", __pyx_getprop_6minari_7dataset_19TransitionMiniBatch_actions, 0, (char *)" Returns mini-batch of actions at `t`.\n\n        Returns:\n            numpy.ndarray: actions at `t`.\n\n        ", 0},
  {(char *)"rewards", __pyx_getprop_6minari_7dataset_19TransitionMiniBatch_rewards, 0, (char *)" Returns mini-batch of rewards at `t`.\n\n        Returns:\n            numpy.ndarray: rewards at `t`.\n\n        ", 0},
  {(char *)"next_observations", __pyx_getprop_6minari_7dataset_19TransitionMiniBatch_next_observations, 0, (char *)" Returns mini-batch of observations at `t+n`.\n\n        Returns:\n            numpy.ndarray or torch.Tensor: observations at `t+n`.\n\n        ", 0},
  {(char *)"terminations", __pyx_getprop_6minari_7dataset_19TransitionMiniBatch_terminations, 0, (char *)" Returns mini-batch of terminal flags at `t+n`.\n\n        Returns:\n            numpy.ndarray: terminal flags at `t+n`.\n\n        ", 0},
  {(char *)"truncations", __pyx_getprop_6minari_7dataset_19TransitionMiniBatch_truncations, 0, (char *)" Returns mini-batch of terminal flags at `t+n`.\n\n        Returns:\n            numpy.ndarray: terminal flags at `t+n`.\n\n        ", 0},
  {(char *)"n_steps", __pyx_getprop_6minari_7dataset_19TransitionMiniBatch_n_steps, 0, (char *)" Returns mini-batch of the number of steps before next observations.\n\n        This will always include only ones if ``n_steps=1``. If ``n_steps`` is\n        bigger than ``1``. the values will depend on its episode length.\n\n        Returns:\n            numpy.ndarray: the number of steps before next observations.\n\n        ", 0},
  {(char *)"transitions", __pyx_getprop_6minari_7dataset_19TransitionMiniBatch_transitions, 0, (char *)" Returns transitions.\n\n        Returns:\n            minari.dataset.Transition: list of transitions.\n\n        ", 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_TransitionMiniBatch = {
  __pyx_pw_6minari_7dataset_19TransitionMiniBatch_5__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_6minari_7dataset_TransitionMiniBatch, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_TransitionMiniBatch = {
  __pyx_pw_6minari_7dataset_19TransitionMiniBatch_5__len__, /*mp_length*/
  __pyx_pw_6minari_7dataset_19TransitionMiniBatch_7__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_6minari_7dataset_TransitionMiniBatch = {
  PyVarObject_HEAD_INIT(0, 0)
  "minari.dataset.TransitionMiniBatch", /*tp_name*/
  sizeof(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6minari_7dataset_TransitionMiniBatch, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_TransitionMiniBatch, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_TransitionMiniBatch, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  " mini-batch of Transition objects.\n\n    This class is designed to hold :class:`minari.dataset.Transition` objects\n    for being passed to algorithms during fitting.\n\n    If the observation is image, you can stack arbitrary frames via\n    ``n_frames``.\n\n    .. code-block:: python\n\n        transition.observation.shape == (3, 84, 84)\n\n        batch_size = len(transitions)\n\n        # stack 4 frames\n        batch = TransitionMiniBatch(transitions, n_frames=4)\n\n        # 4 frames x 3 channels\n        batch.observations.shape == (batch_size, 12, 84, 84)\n\n    This is implemented by tracing previous transitions through\n    ``prev_transition`` property.\n\n    Args:\n        transitions (list(minari.dataset.Transition)):\n            mini-batch of transitions.\n        n_frames (int): the number of frames to stack for image observation.\n        n_steps (int): length of N-step sampling.\n        gamma (float): discount factor for N-step calculation.\n\n    ", /*tp_doc*/
  __pyx_tp_traverse_6minari_7dataset_TransitionMiniBatch, /*tp_traverse*/
  __pyx_tp_clear_6minari_7dataset_TransitionMiniBatch, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6minari_7dataset_19TransitionMiniBatch_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6minari_7dataset_TransitionMiniBatch, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6minari_7dataset_TransitionMiniBatch, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6minari_7dataset_TransitionMiniBatch, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
  0, /*tp_pypy_flags*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_dataset(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_dataset},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "dataset",
    0, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_1_0, __pyx_k_1_0, sizeof(__pyx_k_1_0), 0, 0, 1, 0},
  {&__pyx_kp_u_Action_size_must_be, __pyx_k_Action_size_must_be, sizeof(__pyx_k_Action_size_must_be), 0, 1, 0, 0},
  {&__pyx_kp_s_Dataset_must_have_discrete_actio, __pyx_k_Dataset_must_have_discrete_actio, sizeof(__pyx_k_Dataset_must_have_discrete_actio), 0, 0, 1, 0},
  {&__pyx_n_s_Episode, __pyx_k_Episode, sizeof(__pyx_k_Episode), 0, 0, 1, 1},
  {&__pyx_n_s_Episode___getitem, __pyx_k_Episode___getitem, sizeof(__pyx_k_Episode___getitem), 0, 0, 1, 1},
  {&__pyx_n_s_Episode___init, __pyx_k_Episode___init, sizeof(__pyx_k_Episode___init), 0, 0, 1, 1},
  {&__pyx_n_s_Episode___iter, __pyx_k_Episode___iter, sizeof(__pyx_k_Episode___iter), 0, 0, 1, 1},
  {&__pyx_n_s_Episode___len, __pyx_k_Episode___len, sizeof(__pyx_k_Episode___len), 0, 0, 1, 1},
  {&__pyx_n_s_Episode_actions, __pyx_k_Episode_actions, sizeof(__pyx_k_Episode_actions), 0, 0, 1, 1},
  {&__pyx_n_s_Episode_build_transitions, __pyx_k_Episode_build_transitions, sizeof(__pyx_k_Episode_build_transitions), 0, 0, 1, 1},
  {&__pyx_kp_s_Episode_class_This_class_is_des, __pyx_k_Episode_class_This_class_is_des, sizeof(__pyx_k_Episode_class_This_class_is_des), 0, 0, 1, 0},
  {&__pyx_n_s_Episode_compute_return, __pyx_k_Episode_compute_return, sizeof(__pyx_k_Episode_compute_return), 0, 0, 1, 1},
  {&__pyx_n_s_Episode_get_action_size, __pyx_k_Episode_get_action_size, sizeof(__pyx_k_Episode_get_action_size), 0, 0, 1, 1},
  {&__pyx_n_s_Episode_get_observation_shape, __pyx_k_Episode_get_observation_shape, sizeof(__pyx_k_Episode_get_observation_shape), 0, 0, 1, 1},
  {&__pyx_n_s_Episode_observations, __pyx_k_Episode_observations, sizeof(__pyx_k_Episode_observations), 0, 0, 1, 1},
  {&__pyx_n_s_Episode_rewards, __pyx_k_Episode_rewards, sizeof(__pyx_k_Episode_rewards), 0, 0, 1, 1},
  {&__pyx_n_s_Episode_size, __pyx_k_Episode_size, sizeof(__pyx_k_Episode_size), 0, 0, 1, 1},
  {&__pyx_n_s_Episode_termination, __pyx_k_Episode_termination, sizeof(__pyx_k_Episode_termination), 0, 0, 1, 1},
  {&__pyx_n_s_Episode_transitions, __pyx_k_Episode_transitions, sizeof(__pyx_k_Episode_transitions), 0, 0, 1, 1},
  {&__pyx_n_s_Episode_truncation, __pyx_k_Episode_truncation, sizeof(__pyx_k_Episode_truncation), 0, 0, 1, 1},
  {&__pyx_n_s_File, __pyx_k_File, sizeof(__pyx_k_File), 0, 0, 1, 1},
  {&__pyx_kp_s_Image_observation_must_be_uint8, __pyx_k_Image_observation_must_be_uint8, sizeof(__pyx_k_Image_observation_must_be_uint8), 0, 0, 1, 0},
  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  {&__pyx_n_s_LOG, __pyx_k_LOG, sizeof(__pyx_k_LOG), 0, 0, 1, 1},
  {&__pyx_n_s_MINARI_DATASETS_PATH, __pyx_k_MINARI_DATASETS_PATH, sizeof(__pyx_k_MINARI_DATASETS_PATH), 0, 0, 1, 1},
  {&__pyx_kp_s_Markov_Decision_Process_Dataset, __pyx_k_Markov_Decision_Process_Dataset, sizeof(__pyx_k_Markov_Decision_Process_Dataset), 0, 0, 1, 0},
  {&__pyx_n_s_MinariDataset, __pyx_k_MinariDataset, sizeof(__pyx_k_MinariDataset), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset___getitem, __pyx_k_MinariDataset___getitem, sizeof(__pyx_k_MinariDataset___getitem), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset___init, __pyx_k_MinariDataset___init, sizeof(__pyx_k_MinariDataset___init), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset___iter, __pyx_k_MinariDataset___iter, sizeof(__pyx_k_MinariDataset___iter), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset___len, __pyx_k_MinariDataset___len, sizeof(__pyx_k_MinariDataset___len), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_actions, __pyx_k_MinariDataset_actions, sizeof(__pyx_k_MinariDataset_actions), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_algorithm_name, __pyx_k_MinariDataset_algorithm_name, sizeof(__pyx_k_MinariDataset_algorithm_name), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_append, __pyx_k_MinariDataset_append, sizeof(__pyx_k_MinariDataset_append), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_author, __pyx_k_MinariDataset_author, sizeof(__pyx_k_MinariDataset_author), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_author_email, __pyx_k_MinariDataset_author_email, sizeof(__pyx_k_MinariDataset_author_email), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_build_episodes, __pyx_k_MinariDataset_build_episodes, sizeof(__pyx_k_MinariDataset_build_episodes), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_code_permalink, __pyx_k_MinariDataset_code_permalink, sizeof(__pyx_k_MinariDataset_code_permalink), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_compute_stats, __pyx_k_MinariDataset_compute_stats, sizeof(__pyx_k_MinariDataset_compute_stats), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_dataset_name, __pyx_k_MinariDataset_dataset_name, sizeof(__pyx_k_MinariDataset_dataset_name), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_environment_name, __pyx_k_MinariDataset_environment_name, sizeof(__pyx_k_MinariDataset_environment_name), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_environment_stack, __pyx_k_MinariDataset_environment_stack, sizeof(__pyx_k_MinariDataset_environment_stack), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_episode_terminals, __pyx_k_MinariDataset_episode_terminals, sizeof(__pyx_k_MinariDataset_episode_terminals), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_episodes, __pyx_k_MinariDataset_episodes, sizeof(__pyx_k_MinariDataset_episodes), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_extend, __pyx_k_MinariDataset_extend, sizeof(__pyx_k_MinariDataset_extend), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_get_action_size, __pyx_k_MinariDataset_get_action_size, sizeof(__pyx_k_MinariDataset_get_action_size), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_get_observation_sh, __pyx_k_MinariDataset_get_observation_sh, sizeof(__pyx_k_MinariDataset_get_observation_sh), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_is_action_discrete, __pyx_k_MinariDataset_is_action_discrete, sizeof(__pyx_k_MinariDataset_is_action_discrete), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_load, __pyx_k_MinariDataset_load, sizeof(__pyx_k_MinariDataset_load), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_observations, __pyx_k_MinariDataset_observations, sizeof(__pyx_k_MinariDataset_observations), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_rewards, __pyx_k_MinariDataset_rewards, sizeof(__pyx_k_MinariDataset_rewards), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_save, __pyx_k_MinariDataset_save, sizeof(__pyx_k_MinariDataset_save), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_seed_used, __pyx_k_MinariDataset_seed_used, sizeof(__pyx_k_MinariDataset_seed_used), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_size, __pyx_k_MinariDataset_size, sizeof(__pyx_k_MinariDataset_size), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_terminations, __pyx_k_MinariDataset_terminations, sizeof(__pyx_k_MinariDataset_terminations), 0, 0, 1, 1},
  {&__pyx_n_s_MinariDataset_truncations, __pyx_k_MinariDataset_truncations, sizeof(__pyx_k_MinariDataset_truncations), 0, 0, 1, 1},
  {&__pyx_kp_u_New_action_size_is_higher_than, __pyx_k_New_action_size_is_higher_than, sizeof(__pyx_k_New_action_size_is_higher_than), 0, 1, 0, 0},
  {&__pyx_kp_s_Observation_must_be_numpy_array, __pyx_k_Observation_must_be_numpy_array, sizeof(__pyx_k_Observation_must_be_numpy_array), 0, 0, 1, 0},
  {&__pyx_kp_u_Observation_shape_must_be, __pyx_k_Observation_shape_must_be, sizeof(__pyx_k_Observation_shape_must_be), 0, 1, 0, 0},
  {&__pyx_kp_s_Observations_must_be_numpy_array, __pyx_k_Observations_must_be_numpy_array, sizeof(__pyx_k_Observations_must_be_numpy_array), 0, 0, 1, 0},
  {&__pyx_n_s_Path, __pyx_k_Path, sizeof(__pyx_k_Path), 0, 0, 1, 1},
  {&__pyx_kp_s_The_dataset_structure_might_be_i, __pyx_k_The_dataset_structure_might_be_i, sizeof(__pyx_k_The_dataset_structure_might_be_i), 0, 0, 1, 0},
  {&__pyx_n_s_Transition, __pyx_k_Transition, sizeof(__pyx_k_Transition), 0, 0, 1, 1},
  {&__pyx_n_s_TransitionMiniBatch, __pyx_k_TransitionMiniBatch, sizeof(__pyx_k_TransitionMiniBatch), 0, 0, 1, 1},
  {&__pyx_n_s_TransitionMiniBatch___reduce_cyt, __pyx_k_TransitionMiniBatch___reduce_cyt, sizeof(__pyx_k_TransitionMiniBatch___reduce_cyt), 0, 0, 1, 1},
  {&__pyx_n_s_TransitionMiniBatch___setstate_c, __pyx_k_TransitionMiniBatch___setstate_c, sizeof(__pyx_k_TransitionMiniBatch___setstate_c), 0, 0, 1, 1},
  {&__pyx_n_s_TransitionMiniBatch_size, __pyx_k_TransitionMiniBatch_size, sizeof(__pyx_k_TransitionMiniBatch_size), 0, 0, 1, 1},
  {&__pyx_n_s_Transition___reduce_cython, __pyx_k_Transition___reduce_cython, sizeof(__pyx_k_Transition___reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_Transition___setstate_cython, __pyx_k_Transition___setstate_cython, sizeof(__pyx_k_Transition___setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_Transition_clear_links, __pyx_k_Transition_clear_links, sizeof(__pyx_k_Transition_clear_links), 0, 0, 1, 1},
  {&__pyx_n_s_Transition_get_action_size, __pyx_k_Transition_get_action_size, sizeof(__pyx_k_Transition_get_action_size), 0, 0, 1, 1},
  {&__pyx_n_s_Transition_get_observation_shape, __pyx_k_Transition_get_observation_shape, sizeof(__pyx_k_Transition_get_observation_shape), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_UserWarning, __pyx_k_UserWarning, sizeof(__pyx_k_UserWarning), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_kp_u__32, __pyx_k__32, sizeof(__pyx_k__32), 0, 1, 0, 0},
  {&__pyx_kp_s__35, __pyx_k__35, sizeof(__pyx_k__35), 0, 0, 1, 0},
  {&__pyx_n_s_action, __pyx_k_action, sizeof(__pyx_k_action), 0, 0, 1, 1},
  {&__pyx_n_s_action_size, __pyx_k_action_size, sizeof(__pyx_k_action_size), 0, 0, 1, 1},
  {&__pyx_n_s_actions, __pyx_k_actions, sizeof(__pyx_k_actions), 0, 0, 1, 1},
  {&__pyx_n_s_actions_2, __pyx_k_actions_2, sizeof(__pyx_k_actions_2), 0, 0, 1, 1},
  {&__pyx_n_s_algorithm_name, __pyx_k_algorithm_name, sizeof(__pyx_k_algorithm_name), 0, 0, 1, 1},
  {&__pyx_n_s_algorithm_name_2, __pyx_k_algorithm_name_2, sizeof(__pyx_k_algorithm_name_2), 0, 0, 1, 1},
  {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_arange, __pyx_k_arange, sizeof(__pyx_k_arange), 0, 0, 1, 1},
  {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
  {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1},
  {&__pyx_n_s_author, __pyx_k_author, sizeof(__pyx_k_author), 0, 0, 1, 1},
  {&__pyx_n_s_author_2, __pyx_k_author_2, sizeof(__pyx_k_author_2), 0, 0, 1, 1},
  {&__pyx_n_s_author_email, __pyx_k_author_email, sizeof(__pyx_k_author_email), 0, 0, 1, 1},
  {&__pyx_n_s_author_email_2, __pyx_k_author_email_2, sizeof(__pyx_k_author_email_2), 0, 0, 1, 1},
  {&__pyx_kp_s_author_email_is_set_to_None_For, __pyx_k_author_email_is_set_to_None_For, sizeof(__pyx_k_author_email_is_set_to_None_For), 0, 0, 1, 0},
  {&__pyx_kp_s_author_is_set_to_None_For_longe, __pyx_k_author_is_set_to_None_For_longe, sizeof(__pyx_k_author_is_set_to_None_For_longe), 0, 0, 1, 0},
  {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1},
  {&__pyx_n_s_bins, __pyx_k_bins, sizeof(__pyx_k_bins), 0, 0, 1, 1},
  {&__pyx_n_s_build_episodes, __pyx_k_build_episodes, sizeof(__pyx_k_build_episodes), 0, 0, 1, 1},
  {&__pyx_n_s_build_transitions, __pyx_k_build_transitions, sizeof(__pyx_k_build_transitions), 0, 0, 1, 1},
  {&__pyx_n_s_check_discrete_action, __pyx_k_check_discrete_action, sizeof(__pyx_k_check_discrete_action), 0, 0, 1, 1},
  {&__pyx_n_s_clear_links, __pyx_k_clear_links, sizeof(__pyx_k_clear_links), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_cls, __pyx_k_cls, sizeof(__pyx_k_cls), 0, 0, 1, 1},
  {&__pyx_n_s_code_permalink, __pyx_k_code_permalink, sizeof(__pyx_k_code_permalink), 0, 0, 1, 1},
  {&__pyx_n_s_code_permalink_2, __pyx_k_code_permalink_2, sizeof(__pyx_k_code_permalink_2), 0, 0, 1, 1},
  {&__pyx_kp_s_code_permalink_is_set_to_None_F, __pyx_k_code_permalink_is_set_to_None_F, sizeof(__pyx_k_code_permalink_is_set_to_None_F), 0, 0, 1, 0},
  {&__pyx_n_s_compute_return, __pyx_k_compute_return, sizeof(__pyx_k_compute_return), 0, 0, 1, 1},
  {&__pyx_n_s_compute_stats, __pyx_k_compute_stats, sizeof(__pyx_k_compute_stats), 0, 0, 1, 1},
  {&__pyx_n_s_create_dataset, __pyx_k_create_dataset, sizeof(__pyx_k_create_dataset), 0, 0, 1, 1},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_dataset, __pyx_k_dataset, sizeof(__pyx_k_dataset), 0, 0, 1, 1},
  {&__pyx_n_s_dataset_name, __pyx_k_dataset_name, sizeof(__pyx_k_dataset_name), 0, 0, 1, 1},
  {&__pyx_n_s_dataset_name_2, __pyx_k_dataset_name_2, sizeof(__pyx_k_dataset_name_2), 0, 0, 1, 1},
  {&__pyx_n_s_datasets, __pyx_k_datasets, sizeof(__pyx_k_datasets), 0, 0, 1, 1},
  {&__pyx_n_s_datasets_path, __pyx_k_datasets_path, sizeof(__pyx_k_datasets_path), 0, 0, 1, 1},
  {&__pyx_n_s_discrete_action, __pyx_k_discrete_action, sizeof(__pyx_k_discrete_action), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
  {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
  {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
  {&__pyx_n_s_environ, __pyx_k_environ, sizeof(__pyx_k_environ), 0, 0, 1, 1},
  {&__pyx_n_s_environment_name, __pyx_k_environment_name, sizeof(__pyx_k_environment_name), 0, 0, 1, 1},
  {&__pyx_n_s_environment_name_2, __pyx_k_environment_name_2, sizeof(__pyx_k_environment_name_2), 0, 0, 1, 1},
  {&__pyx_n_s_environment_stack, __pyx_k_environment_stack, sizeof(__pyx_k_environment_stack), 0, 0, 1, 1},
  {&__pyx_n_s_environment_stack_2, __pyx_k_environment_stack_2, sizeof(__pyx_k_environment_stack_2), 0, 0, 1, 1},
  {&__pyx_kp_s_environment_stack_is_set_to_Non, __pyx_k_environment_stack_is_set_to_Non, sizeof(__pyx_k_environment_stack_is_set_to_Non), 0, 0, 1, 0},
  {&__pyx_n_s_episode, __pyx_k_episode, sizeof(__pyx_k_episode), 0, 0, 1, 1},
  {&__pyx_n_s_episode_returns, __pyx_k_episode_returns, sizeof(__pyx_k_episode_returns), 0, 0, 1, 1},
  {&__pyx_n_s_episode_terminals, __pyx_k_episode_terminals, sizeof(__pyx_k_episode_terminals), 0, 0, 1, 1},
  {&__pyx_n_s_episode_terminals_2, __pyx_k_episode_terminals_2, sizeof(__pyx_k_episode_terminals_2), 0, 0, 1, 1},
  {&__pyx_n_s_episodes, __pyx_k_episodes, sizeof(__pyx_k_episodes), 0, 0, 1, 1},
  {&__pyx_n_s_episodes_2, __pyx_k_episodes_2, sizeof(__pyx_k_episodes_2), 0, 0, 1, 1},
  {&__pyx_n_s_exist_ok, __pyx_k_exist_ok, sizeof(__pyx_k_exist_ok), 0, 0, 1, 1},
  {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
  {&__pyx_n_s_expanduser, __pyx_k_expanduser, sizeof(__pyx_k_expanduser), 0, 0, 1, 1},
  {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1},
  {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
  {&__pyx_n_s_file_path, __pyx_k_file_path, sizeof(__pyx_k_file_path), 0, 0, 1, 1},
  {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1},
  {&__pyx_n_s_float_actions, __pyx_k_float_actions, sizeof(__pyx_k_float_actions), 0, 0, 1, 1},
  {&__pyx_n_s_flush, __pyx_k_flush, sizeof(__pyx_k_flush), 0, 0, 1, 1},
  {&__pyx_n_s_fname, __pyx_k_fname, sizeof(__pyx_k_fname), 0, 0, 1, 1},
  {&__pyx_n_s_freqs, __pyx_k_freqs, sizeof(__pyx_k_freqs), 0, 0, 1, 1},
  {&__pyx_n_s_gamma, __pyx_k_gamma, sizeof(__pyx_k_gamma), 0, 0, 1, 1},
  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  {&__pyx_n_s_get_action_size, __pyx_k_get_action_size, sizeof(__pyx_k_get_action_size), 0, 0, 1, 1},
  {&__pyx_n_s_get_observation_shape, __pyx_k_get_observation_shape, sizeof(__pyx_k_get_observation_shape), 0, 0, 1, 1},
  {&__pyx_n_s_getitem, __pyx_k_getitem, sizeof(__pyx_k_getitem), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_n_s_h5py, __pyx_k_h5py, sizeof(__pyx_k_h5py), 0, 0, 1, 1},
  {&__pyx_kp_u_hdf5, __pyx_k_hdf5, sizeof(__pyx_k_hdf5), 0, 1, 0, 0},
  {&__pyx_n_s_head_index, __pyx_k_head_index, sizeof(__pyx_k_head_index), 0, 0, 1, 1},
  {&__pyx_n_s_histogram, __pyx_k_histogram, sizeof(__pyx_k_histogram), 0, 0, 1, 1},
  {&__pyx_n_s_hists, __pyx_k_hists, sizeof(__pyx_k_hists), 0, 0, 1, 1},
  {&__pyx_n_s_hstack, __pyx_k_hstack, sizeof(__pyx_k_hstack), 0, 0, 1, 1},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1},
  {&__pyx_n_s_int_actions, __pyx_k_int_actions, sizeof(__pyx_k_int_actions), 0, 0, 1, 1},
  {&__pyx_n_s_is_action_discrete, __pyx_k_is_action_discrete, sizeof(__pyx_k_is_action_discrete), 0, 0, 1, 1},
  {&__pyx_n_s_isnan, __pyx_k_isnan, sizeof(__pyx_k_isnan), 0, 0, 1, 1},
  {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1},
  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
  {&__pyx_n_s_len, __pyx_k_len, sizeof(__pyx_k_len), 0, 0, 1, 1},
  {&__pyx_n_s_load, __pyx_k_load, sizeof(__pyx_k_load), 0, 0, 1, 1},
  {&__pyx_n_s_logger, __pyx_k_logger, sizeof(__pyx_k_logger), 0, 0, 1, 1},
  {&__pyx_n_s_logical_not, __pyx_k_logical_not, sizeof(__pyx_k_logical_not), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_makedirs, __pyx_k_makedirs, sizeof(__pyx_k_makedirs), 0, 0, 1, 1},
  {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
  {&__pyx_n_s_mean, __pyx_k_mean, sizeof(__pyx_k_mean), 0, 0, 1, 1},
  {&__pyx_n_s_message, __pyx_k_message, sizeof(__pyx_k_message), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
  {&__pyx_kp_s_minari, __pyx_k_minari, sizeof(__pyx_k_minari), 0, 0, 1, 0},
  {&__pyx_n_s_minari_dataset, __pyx_k_minari_dataset, sizeof(__pyx_k_minari_dataset), 0, 0, 1, 1},
  {&__pyx_kp_s_minari_dataset_pyx, __pyx_k_minari_dataset_pyx, sizeof(__pyx_k_minari_dataset_pyx), 0, 0, 1, 0},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_n_frames, __pyx_k_n_frames, sizeof(__pyx_k_n_frames), 0, 0, 1, 1},
  {&__pyx_n_s_n_steps, __pyx_k_n_steps, sizeof(__pyx_k_n_steps), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_next_observation, __pyx_k_next_observation, sizeof(__pyx_k_next_observation), 0, 0, 1, 1},
  {&__pyx_n_s_next_transition, __pyx_k_next_transition, sizeof(__pyx_k_next_transition), 0, 0, 1, 1},
  {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  {&__pyx_n_s_num_data, __pyx_k_num_data, sizeof(__pyx_k_num_data), 0, 0, 1, 1},
  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
  {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
  {&__pyx_n_s_observation, __pyx_k_observation, sizeof(__pyx_k_observation), 0, 0, 1, 1},
  {&__pyx_n_s_observation_shape, __pyx_k_observation_shape, sizeof(__pyx_k_observation_shape), 0, 0, 1, 1},
  {&__pyx_n_s_observations, __pyx_k_observations, sizeof(__pyx_k_observations), 0, 0, 1, 1},
  {&__pyx_n_s_observations_2, __pyx_k_observations_2, sizeof(__pyx_k_observations_2), 0, 0, 1, 1},
  {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
  {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
  {&__pyx_n_s_pathlib, __pyx_k_pathlib, sizeof(__pyx_k_pathlib), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_prev_transition, __pyx_k_prev_transition, sizeof(__pyx_k_prev_transition), 0, 0, 1, 1},
  {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  {&__pyx_n_s_reshape, __pyx_k_reshape, sizeof(__pyx_k_reshape), 0, 0, 1, 1},
  {&__pyx_n_s_rets, __pyx_k_rets, sizeof(__pyx_k_rets), 0, 0, 1, 1},
  {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1},
  {&__pyx_n_s_reward, __pyx_k_reward, sizeof(__pyx_k_reward), 0, 0, 1, 1},
  {&__pyx_n_s_rewards, __pyx_k_rewards, sizeof(__pyx_k_rewards), 0, 0, 1, 1},
  {&__pyx_n_s_rewards_2, __pyx_k_rewards_2, sizeof(__pyx_k_rewards_2), 0, 0, 1, 1},
  {&__pyx_n_s_safe_size, __pyx_k_safe_size, sizeof(__pyx_k_safe_size), 0, 0, 1, 1},
  {&__pyx_n_s_save, __pyx_k_save, sizeof(__pyx_k_save), 0, 0, 1, 1},
  {&__pyx_n_s_seed_used, __pyx_k_seed_used, sizeof(__pyx_k_seed_used), 0, 0, 1, 1},
  {&__pyx_n_s_seed_used_2, __pyx_k_seed_used_2, sizeof(__pyx_k_seed_used_2), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
  {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
  {&__pyx_n_s_stats, __pyx_k_stats, sizeof(__pyx_k_stats), 0, 0, 1, 1},
  {&__pyx_n_s_std, __pyx_k_std, sizeof(__pyx_k_std), 0, 0, 1, 1},
  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
  {&__pyx_n_s_termination, __pyx_k_termination, sizeof(__pyx_k_termination), 0, 0, 1, 1},
  {&__pyx_n_s_termination_2, __pyx_k_termination_2, sizeof(__pyx_k_termination_2), 0, 0, 1, 1},
  {&__pyx_n_s_terminations, __pyx_k_terminations, sizeof(__pyx_k_terminations), 0, 0, 1, 1},
  {&__pyx_n_s_terminations_2, __pyx_k_terminations_2, sizeof(__pyx_k_terminations_2), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_to_episodes, __pyx_k_to_episodes, sizeof(__pyx_k_to_episodes), 0, 0, 1, 1},
  {&__pyx_n_s_to_transitions, __pyx_k_to_transitions, sizeof(__pyx_k_to_transitions), 0, 0, 1, 1},
  {&__pyx_n_s_trace_back_and_clear, __pyx_k_trace_back_and_clear, sizeof(__pyx_k_trace_back_and_clear), 0, 0, 1, 1},
  {&__pyx_n_s_transition, __pyx_k_transition, sizeof(__pyx_k_transition), 0, 0, 1, 1},
  {&__pyx_n_s_transitions, __pyx_k_transitions, sizeof(__pyx_k_transitions), 0, 0, 1, 1},
  {&__pyx_n_s_transitions_2, __pyx_k_transitions_2, sizeof(__pyx_k_transitions_2), 0, 0, 1, 1},
  {&__pyx_n_s_truncation, __pyx_k_truncation, sizeof(__pyx_k_truncation), 0, 0, 1, 1},
  {&__pyx_n_s_truncation_2, __pyx_k_truncation_2, sizeof(__pyx_k_truncation_2), 0, 0, 1, 1},
  {&__pyx_n_s_truncations, __pyx_k_truncations, sizeof(__pyx_k_truncations), 0, 0, 1, 1},
  {&__pyx_n_s_truncations_2, __pyx_k_truncations_2, sizeof(__pyx_k_truncations_2), 0, 0, 1, 1},
  {&__pyx_n_s_uint8, __pyx_k_uint8, sizeof(__pyx_k_uint8), 0, 0, 1, 1},
  {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1},
  {&__pyx_n_s_vstack, __pyx_k_vstack, sizeof(__pyx_k_vstack), 0, 0, 1, 1},
  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
  {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1},
  {&__pyx_n_s_warning, __pyx_k_warning, sizeof(__pyx_k_warning), 0, 0, 1, 1},
  {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1},
  {&__pyx_n_s_zeros_like, __pyx_k_zeros_like, sizeof(__pyx_k_zeros_like), 0, 0, 1, 1},
  {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 263, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 40, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 55, __pyx_L1_error)
  __pyx_builtin_UserWarning = __Pyx_GetBuiltinName(__pyx_n_s_UserWarning); if (!__pyx_builtin_UserWarning) __PYX_ERR(0, 214, __pyx_L1_error)
  __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 516, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 944, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "minari/dataset.pyx":214
 *         # NoneType warnings
 *         if code_permalink is None:
 *             warnings.warn("`code_permalink` is set to None. For reproducibility purposes it is highly recommended to link your dataset to versioned code.", UserWarning)             # <<<<<<<<<<<<<<
 *         if author is None:
 *             warnings.warn("`author` is set to None. For longevity purposes it is highly recommended to provide an author name.", UserWarning)
 */
  __pyx_tuple__6 = PyTuple_Pack(2, __pyx_kp_s_code_permalink_is_set_to_None_F, __pyx_builtin_UserWarning); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "minari/dataset.pyx":216
 *             warnings.warn("`code_permalink` is set to None. For reproducibility purposes it is highly recommended to link your dataset to versioned code.", UserWarning)
 *         if author is None:
 *             warnings.warn("`author` is set to None. For longevity purposes it is highly recommended to provide an author name.", UserWarning)             # <<<<<<<<<<<<<<
 *         if author_email is None:
 *             warnings.warn("`author_email` is set to None. For longevity purposes it is highly recommended to provide an author email, or some other obvious contact information.", UserWarning)
 */
  __pyx_tuple__7 = PyTuple_Pack(2, __pyx_kp_s_author_is_set_to_None_For_longe, __pyx_builtin_UserWarning); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "minari/dataset.pyx":218
 *             warnings.warn("`author` is set to None. For longevity purposes it is highly recommended to provide an author name.", UserWarning)
 *         if author_email is None:
 *             warnings.warn("`author_email` is set to None. For longevity purposes it is highly recommended to provide an author email, or some other obvious contact information.", UserWarning)             # <<<<<<<<<<<<<<
 *         if environment_stack is None:
 *             warnings.warn("`environment_stack` is set to None. For reproducibility purposes it is highly recommended to provide the environment stack.", UserWarning)
 */
  __pyx_tuple__8 = PyTuple_Pack(2, __pyx_kp_s_author_email_is_set_to_None_For, __pyx_builtin_UserWarning); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "minari/dataset.pyx":220
 *             warnings.warn("`author_email` is set to None. For longevity purposes it is highly recommended to provide an author email, or some other obvious contact information.", UserWarning)
 *         if environment_stack is None:
 *             warnings.warn("`environment_stack` is set to None. For reproducibility purposes it is highly recommended to provide the environment stack.", UserWarning)             # <<<<<<<<<<<<<<
 * 
 *         # validation
 */
  __pyx_tuple__9 = PyTuple_Pack(2, __pyx_kp_s_environment_stack_is_set_to_Non, __pyx_builtin_UserWarning); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "minari/dataset.pyx":469
 *             hists = []
 *             for i in range(self.get_action_size()):
 *                 hists.append(np.histogram(self.actions[:, i], bins=20))             # <<<<<<<<<<<<<<
 *             stats['action'] = {
 *                 'mean': np.mean(self.actions, axis=0),
 */
  __pyx_slice__30 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__30)) __PYX_ERR(0, 469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__30);
  __Pyx_GIVEREF(__pyx_slice__30);

  /* "minari/dataset.pyx":599
 * 
 *         with h5py.File(file_path, 'w') as f:
 *             f.create_dataset('dataset_name', data=self._dataset_name)             # <<<<<<<<<<<<<<
 *             f.create_dataset('algorithm_name', data=self._algorithm_name)
 *             f.create_dataset('environment_name', data=self._environment_name)
 */
  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_n_s_dataset_name); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "minari/dataset.pyx":600
 *         with h5py.File(file_path, 'w') as f:
 *             f.create_dataset('dataset_name', data=self._dataset_name)
 *             f.create_dataset('algorithm_name', data=self._algorithm_name)             # <<<<<<<<<<<<<<
 *             f.create_dataset('environment_name', data=self._environment_name)
 *             f.create_dataset('environment_stack', data=str(self._environment_stack))
 */
  __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_algorithm_name); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "minari/dataset.pyx":601
 *             f.create_dataset('dataset_name', data=self._dataset_name)
 *             f.create_dataset('algorithm_name', data=self._algorithm_name)
 *             f.create_dataset('environment_name', data=self._environment_name)             # <<<<<<<<<<<<<<
 *             f.create_dataset('environment_stack', data=str(self._environment_stack))
 *             f.create_dataset('seed_used', data=self._seed_used)
 */
  __pyx_tuple__38 = PyTuple_Pack(1, __pyx_n_s_environment_name); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "minari/dataset.pyx":602
 *             f.create_dataset('algorithm_name', data=self._algorithm_name)
 *             f.create_dataset('environment_name', data=self._environment_name)
 *             f.create_dataset('environment_stack', data=str(self._environment_stack))             # <<<<<<<<<<<<<<
 *             f.create_dataset('seed_used', data=self._seed_used)
 *             f.create_dataset('code_permalink', data=str(self._code_permalink))  # allows saving of NoneType
 */
  __pyx_tuple__39 = PyTuple_Pack(1, __pyx_n_s_environment_stack); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "minari/dataset.pyx":603
 *             f.create_dataset('environment_name', data=self._environment_name)
 *             f.create_dataset('environment_stack', data=str(self._environment_stack))
 *             f.create_dataset('seed_used', data=self._seed_used)             # <<<<<<<<<<<<<<
 *             f.create_dataset('code_permalink', data=str(self._code_permalink))  # allows saving of NoneType
 *             f.create_dataset('author', data=str(self._author))
 */
  __pyx_tuple__40 = PyTuple_Pack(1, __pyx_n_s_seed_used); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "minari/dataset.pyx":604
 *             f.create_dataset('environment_stack', data=str(self._environment_stack))
 *             f.create_dataset('seed_used', data=self._seed_used)
 *             f.create_dataset('code_permalink', data=str(self._code_permalink))  # allows saving of NoneType             # <<<<<<<<<<<<<<
 *             f.create_dataset('author', data=str(self._author))
 *             f.create_dataset('author_email', data=str(self._author_email))
 */
  __pyx_tuple__41 = PyTuple_Pack(1, __pyx_n_s_code_permalink); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "minari/dataset.pyx":605
 *             f.create_dataset('seed_used', data=self._seed_used)
 *             f.create_dataset('code_permalink', data=str(self._code_permalink))  # allows saving of NoneType
 *             f.create_dataset('author', data=str(self._author))             # <<<<<<<<<<<<<<
 *             f.create_dataset('author_email', data=str(self._author_email))
 *             f.create_dataset('observations', data=self._observations)
 */
  __pyx_tuple__42 = PyTuple_Pack(1, __pyx_n_s_author); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "minari/dataset.pyx":606
 *             f.create_dataset('code_permalink', data=str(self._code_permalink))  # allows saving of NoneType
 *             f.create_dataset('author', data=str(self._author))
 *             f.create_dataset('author_email', data=str(self._author_email))             # <<<<<<<<<<<<<<
 *             f.create_dataset('observations', data=self._observations)
 *             f.create_dataset('actions', data=self._actions)
 */
  __pyx_tuple__43 = PyTuple_Pack(1, __pyx_n_s_author_email); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "minari/dataset.pyx":607
 *             f.create_dataset('author', data=str(self._author))
 *             f.create_dataset('author_email', data=str(self._author_email))
 *             f.create_dataset('observations', data=self._observations)             # <<<<<<<<<<<<<<
 *             f.create_dataset('actions', data=self._actions)
 *             f.create_dataset('rewards', data=self._rewards)
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_n_s_observations); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "minari/dataset.pyx":608
 *             f.create_dataset('author_email', data=str(self._author_email))
 *             f.create_dataset('observations', data=self._observations)
 *             f.create_dataset('actions', data=self._actions)             # <<<<<<<<<<<<<<
 *             f.create_dataset('rewards', data=self._rewards)
 *             f.create_dataset('terminations', data=self._terminations)
 */
  __pyx_tuple__45 = PyTuple_Pack(1, __pyx_n_s_actions); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "minari/dataset.pyx":609
 *             f.create_dataset('observations', data=self._observations)
 *             f.create_dataset('actions', data=self._actions)
 *             f.create_dataset('rewards', data=self._rewards)             # <<<<<<<<<<<<<<
 *             f.create_dataset('terminations', data=self._terminations)
 *             f.create_dataset('truncations', data=self._truncations)
 */
  __pyx_tuple__46 = PyTuple_Pack(1, __pyx_n_s_rewards); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);

  /* "minari/dataset.pyx":610
 *             f.create_dataset('actions', data=self._actions)
 *             f.create_dataset('rewards', data=self._rewards)
 *             f.create_dataset('terminations', data=self._terminations)             # <<<<<<<<<<<<<<
 *             f.create_dataset('truncations', data=self._truncations)
 *             f.create_dataset('episode_terminals', data=self._episode_terminals)
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_n_s_terminations); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "minari/dataset.pyx":611
 *             f.create_dataset('rewards', data=self._rewards)
 *             f.create_dataset('terminations', data=self._terminations)
 *             f.create_dataset('truncations', data=self._truncations)             # <<<<<<<<<<<<<<
 *             f.create_dataset('episode_terminals', data=self._episode_terminals)
 *             f.create_dataset('discrete_action', data=self.discrete_action)
 */
  __pyx_tuple__48 = PyTuple_Pack(1, __pyx_n_s_truncations); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "minari/dataset.pyx":612
 *             f.create_dataset('terminations', data=self._terminations)
 *             f.create_dataset('truncations', data=self._truncations)
 *             f.create_dataset('episode_terminals', data=self._episode_terminals)             # <<<<<<<<<<<<<<
 *             f.create_dataset('discrete_action', data=self.discrete_action)
 *             f.create_dataset('version', data='1.0')
 */
  __pyx_tuple__49 = PyTuple_Pack(1, __pyx_n_s_episode_terminals); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "minari/dataset.pyx":613
 *             f.create_dataset('truncations', data=self._truncations)
 *             f.create_dataset('episode_terminals', data=self._episode_terminals)
 *             f.create_dataset('discrete_action', data=self.discrete_action)             # <<<<<<<<<<<<<<
 *             f.create_dataset('version', data='1.0')
 *             f.flush()
 */
  __pyx_tuple__50 = PyTuple_Pack(1, __pyx_n_s_discrete_action); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "minari/dataset.pyx":614
 *             f.create_dataset('episode_terminals', data=self._episode_terminals)
 *             f.create_dataset('discrete_action', data=self.discrete_action)
 *             f.create_dataset('version', data='1.0')             # <<<<<<<<<<<<<<
 *             f.flush()
 * 
 */
  __pyx_tuple__51 = PyTuple_Pack(1, __pyx_n_s_version); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);

  /* "minari/dataset.pyx":598
 *         os.makedirs(datasets_path, exist_ok=True)
 * 
 *         with h5py.File(file_path, 'w') as f:             # <<<<<<<<<<<<<<
 *             f.create_dataset('dataset_name', data=self._dataset_name)
 *             f.create_dataset('algorithm_name', data=self._algorithm_name)
 */
  __pyx_tuple__52 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__77 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__77);
  __Pyx_GIVEREF(__pyx_tuple__77);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__79 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__79);
  __Pyx_GIVEREF(__pyx_tuple__79);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__83 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__83);
  __Pyx_GIVEREF(__pyx_tuple__83);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__85 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__85);
  __Pyx_GIVEREF(__pyx_tuple__85);

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":944
 *         __pyx_import_array()
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
 */
  __pyx_tuple__86 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(2, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__86);
  __Pyx_GIVEREF(__pyx_tuple__86);

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":950
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
 */
  __pyx_tuple__87 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(2, 950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__87);
  __Pyx_GIVEREF(__pyx_tuple__87);

  /* "minari/dataset.pyx":35
 * 
 * 
 * def _safe_size(array):             # <<<<<<<<<<<<<<
 *     if isinstance(array, (list, tuple)):
 *         return len(array)
 */
  __pyx_tuple__88 = PyTuple_Pack(1, __pyx_n_s_array); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__88);
  __Pyx_GIVEREF(__pyx_tuple__88);
  __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__88, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_safe_size, 35, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 35, __pyx_L1_error)

  /* "minari/dataset.pyx":43
 * 
 * 
 * def _to_episodes(             # <<<<<<<<<<<<<<
 *     observation_shape,
 *     action_size,
 */
  __pyx_tuple__89 = PyTuple_Pack(12, __pyx_n_s_observation_shape, __pyx_n_s_action_size, __pyx_n_s_observations, __pyx_n_s_actions, __pyx_n_s_rewards, __pyx_n_s_terminations, __pyx_n_s_truncations, __pyx_n_s_episode_terminals, __pyx_n_s_rets, __pyx_n_s_head_index, __pyx_n_s_i, __pyx_n_s_episode); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__89);
  __Pyx_GIVEREF(__pyx_tuple__89);
  __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(8, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_to_episodes, 43, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 43, __pyx_L1_error)

  /* "minari/dataset.pyx":71
 * 
 * 
 * def _to_transitions(             # <<<<<<<<<<<<<<
 *     observation_shape,
 *     action_size,
 */
  __pyx_tuple__90 = PyTuple_Pack(16, __pyx_n_s_observation_shape, __pyx_n_s_action_size, __pyx_n_s_observations, __pyx_n_s_actions, __pyx_n_s_rewards, __pyx_n_s_termination, __pyx_n_s_truncation, __pyx_n_s_rets, __pyx_n_s_num_data, __pyx_n_s_prev_transition, __pyx_n_s_i, __pyx_n_s_observation, __pyx_n_s_action, __pyx_n_s_reward, __pyx_n_s_next_observation, __pyx_n_s_transition); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__90);
  __Pyx_GIVEREF(__pyx_tuple__90);
  __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(7, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__90, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_to_transitions, 71, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 71, __pyx_L1_error)

  /* "minari/dataset.pyx":120
 * 
 * 
 * def _check_discrete_action(actions):             # <<<<<<<<<<<<<<
 *     float_actions = np.array(actions, dtype=np.float32)
 *     int_actions = np.array(actions, dtype=np.int32)
 */
  __pyx_tuple__91 = PyTuple_Pack(3, __pyx_n_s_actions, __pyx_n_s_float_actions, __pyx_n_s_int_actions); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__91);
  __Pyx_GIVEREF(__pyx_tuple__91);
  __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_check_discrete_action, 120, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 120, __pyx_L1_error)

  /* "minari/dataset.pyx":185
 * 
 *     """
 *     def __init__(             # <<<<<<<<<<<<<<
 *         self,
 *         dataset_name,
 */
  __pyx_tuple__92 = PyTuple_Pack(16, __pyx_n_s_self, __pyx_n_s_dataset_name, __pyx_n_s_algorithm_name, __pyx_n_s_environment_name, __pyx_n_s_environment_stack, __pyx_n_s_seed_used, __pyx_n_s_code_permalink, __pyx_n_s_author, __pyx_n_s_author_email, __pyx_n_s_observations, __pyx_n_s_actions, __pyx_n_s_rewards, __pyx_n_s_terminations, __pyx_n_s_truncations, __pyx_n_s_episode_terminals, __pyx_n_s_discrete_action); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__92);
  __Pyx_GIVEREF(__pyx_tuple__92);
  __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(16, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_init, 185, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 185, __pyx_L1_error)
  __pyx_tuple__93 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__93);
  __Pyx_GIVEREF(__pyx_tuple__93);

  /* "minari/dataset.pyx":264
 * 
 *     @property
 *     def dataset_name(self):             # <<<<<<<<<<<<<<
 *         return self._dataset_name
 * 
 */
  __pyx_tuple__94 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__94);
  __Pyx_GIVEREF(__pyx_tuple__94);
  __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__94, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_dataset_name, 264, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 264, __pyx_L1_error)

  /* "minari/dataset.pyx":268
 * 
 *     @property
 *     def algorithm_name(self):             # <<<<<<<<<<<<<<
 *         return self._algorithm_name
 * 
 */
  __pyx_tuple__95 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__95);
  __Pyx_GIVEREF(__pyx_tuple__95);
  __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_algorithm_name, 268, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 268, __pyx_L1_error)

  /* "minari/dataset.pyx":272
 * 
 *     @property
 *     def environment_name(self):             # <<<<<<<<<<<<<<
 *         return self._environment_name
 * 
 */
  __pyx_tuple__96 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(0, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__96);
  __Pyx_GIVEREF(__pyx_tuple__96);
  __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__96, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_environment_name, 272, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 272, __pyx_L1_error)

  /* "minari/dataset.pyx":276
 * 
 *     @property
 *     def environment_stack(self):             # <<<<<<<<<<<<<<
 *         return self._environment_stack
 * 
 */
  __pyx_tuple__97 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__97);
  __Pyx_GIVEREF(__pyx_tuple__97);
  __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__97, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_environment_stack, 276, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 276, __pyx_L1_error)

  /* "minari/dataset.pyx":280
 * 
 *     @property
 *     def seed_used(self):             # <<<<<<<<<<<<<<
 *         return self._seed_used
 * 
 */
  __pyx_tuple__98 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(0, 280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__98);
  __Pyx_GIVEREF(__pyx_tuple__98);
  __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__98, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_seed_used, 280, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 280, __pyx_L1_error)

  /* "minari/dataset.pyx":284
 * 
 *     @property
 *     def code_permalink(self):             # <<<<<<<<<<<<<<
 *         return self._code_permalink
 * 
 */
  __pyx_tuple__99 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__99);
  __Pyx_GIVEREF(__pyx_tuple__99);
  __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__99, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_code_permalink, 284, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 284, __pyx_L1_error)

  /* "minari/dataset.pyx":288
 * 
 *     @property
 *     def author(self):             # <<<<<<<<<<<<<<
 *         return self._author
 * 
 */
  __pyx_tuple__100 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__100)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__100);
  __Pyx_GIVEREF(__pyx_tuple__100);
  __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__100, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_author, 288, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 288, __pyx_L1_error)

  /* "minari/dataset.pyx":292
 * 
 *     @property
 *     def author_email(self):             # <<<<<<<<<<<<<<
 *         return self._author_email
 * 
 */
  __pyx_tuple__101 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__101);
  __Pyx_GIVEREF(__pyx_tuple__101);
  __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_author_email, 292, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 292, __pyx_L1_error)

  /* "minari/dataset.pyx":296
 * 
 *     @property
 *     def observations(self):             # <<<<<<<<<<<<<<
 *         """ Returns the observations.
 * 
 */
  __pyx_tuple__102 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__102)) __PYX_ERR(0, 296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__102);
  __Pyx_GIVEREF(__pyx_tuple__102);
  __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__102, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_observations, 296, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 296, __pyx_L1_error)

  /* "minari/dataset.pyx":306
 * 
 *     @property
 *     def actions(self):             # <<<<<<<<<<<<<<
 *         """ Returns the actions.
 * 
 */
  __pyx_tuple__103 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__103);
  __Pyx_GIVEREF(__pyx_tuple__103);
  __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__103, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_actions, 306, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 306, __pyx_L1_error)

  /* "minari/dataset.pyx":316
 * 
 *     @property
 *     def rewards(self):             # <<<<<<<<<<<<<<
 *         """ Returns the rewards.
 * 
 */
  __pyx_tuple__104 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__104);
  __Pyx_GIVEREF(__pyx_tuple__104);
  __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__104, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_rewards, 316, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 316, __pyx_L1_error)

  /* "minari/dataset.pyx":326
 * 
 *     @property
 *     def terminations(self):             # <<<<<<<<<<<<<<
 *         """ Returns the terminations flags.
 * 
 */
  __pyx_tuple__105 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__105)) __PYX_ERR(0, 326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__105);
  __Pyx_GIVEREF(__pyx_tuple__105);
  __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__105, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_terminations, 326, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 326, __pyx_L1_error)

  /* "minari/dataset.pyx":336
 * 
 *     @property
 *     def truncations(self):             # <<<<<<<<<<<<<<
 *         """ Returns the terminations flags.
 * 
 */
  __pyx_tuple__106 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(0, 336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__106);
  __Pyx_GIVEREF(__pyx_tuple__106);
  __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_truncations, 336, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 336, __pyx_L1_error)

  /* "minari/dataset.pyx":345
 *         return self._truncations
 *     @property
 *     def episode_terminals(self):             # <<<<<<<<<<<<<<
 *         """ Returns the episode terminal flags.
 * 
 */
  __pyx_tuple__107 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__107)) __PYX_ERR(0, 345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__107);
  __Pyx_GIVEREF(__pyx_tuple__107);
  __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__107, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_episode_terminals, 345, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 345, __pyx_L1_error)

  /* "minari/dataset.pyx":355
 * 
 *     @property
 *     def episodes(self):             # <<<<<<<<<<<<<<
 *         """ Returns the episodes.
 * 
 */
  __pyx_tuple__108 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__108);
  __Pyx_GIVEREF(__pyx_tuple__108);
  __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_episodes_2, 355, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 355, __pyx_L1_error)

  /* "minari/dataset.pyx":367
 *         return self._episodes
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         """ Returns the number of episodes in the dataset.
 * 
 */
  __pyx_tuple__109 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__109)) __PYX_ERR(0, 367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__109);
  __Pyx_GIVEREF(__pyx_tuple__109);
  __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__109, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_size, 367, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 367, __pyx_L1_error)

  /* "minari/dataset.pyx":376
 *         return len(self.episodes)
 * 
 *     def get_action_size(self):             # <<<<<<<<<<<<<<
 *         """ Returns dimension of action-space.
 * 
 */
  __pyx_tuple__110 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__110);
  __Pyx_GIVEREF(__pyx_tuple__110);
  __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_get_action_size, 376, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 376, __pyx_L1_error)

  /* "minari/dataset.pyx":390
 *         return self._actions.shape[1]
 * 
 *     def get_observation_shape(self):             # <<<<<<<<<<<<<<
 *         """ Returns observation shape.
 * 
 */
  __pyx_tuple__111 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__111)) __PYX_ERR(0, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__111);
  __Pyx_GIVEREF(__pyx_tuple__111);
  __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__111, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_get_observation_shape, 390, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 390, __pyx_L1_error)

  /* "minari/dataset.pyx":399
 *         return self._observations[0].shape
 * 
 *     def is_action_discrete(self):             # <<<<<<<<<<<<<<
 *         """ Returns `discrete_action` flag.
 * 
 */
  __pyx_tuple__112 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__112);
  __Pyx_GIVEREF(__pyx_tuple__112);
  __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_is_action_discrete, 399, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 399, __pyx_L1_error)

  /* "minari/dataset.pyx":408
 *         return self.discrete_action
 * 
 *     def compute_stats(self):             # <<<<<<<<<<<<<<
 *         """ Computes statistics of the dataset.
 * 
 */
  __pyx_tuple__113 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_episode_returns, __pyx_n_s_episode, __pyx_n_s_stats, __pyx_n_s_hists, __pyx_n_s_i, __pyx_n_s_freqs); if (unlikely(!__pyx_tuple__113)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__113);
  __Pyx_GIVEREF(__pyx_tuple__113);
  __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_compute_stats, 408, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 408, __pyx_L1_error)

  /* "minari/dataset.pyx":496
 *         return stats
 * 
 *     def append(             # <<<<<<<<<<<<<<
 *         self,
 *         observations,
 */
  __pyx_tuple__114 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_observations, __pyx_n_s_actions, __pyx_n_s_rewards, __pyx_n_s_terminations, __pyx_n_s_truncations, __pyx_n_s_episode_terminals, __pyx_n_s_observation, __pyx_n_s_action, __pyx_n_s_message, __pyx_n_s_episodes_2); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__114);
  __Pyx_GIVEREF(__pyx_tuple__114);
  __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_append, 496, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 496, __pyx_L1_error)
  __pyx_tuple__115 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__115)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__115);
  __Pyx_GIVEREF(__pyx_tuple__115);

  /* "minari/dataset.pyx":561
 *         self._episodes = episodes
 * 
 *     def extend(self, dataset):             # <<<<<<<<<<<<<<
 *         """ Extend dataset by another dataset.
 * 
 */
  __pyx_tuple__116 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_dataset); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(0, 561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__116);
  __Pyx_GIVEREF(__pyx_tuple__116);
  __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_extend, 561, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 561, __pyx_L1_error)

  /* "minari/dataset.pyx":582
 *         )
 * 
 *     def save(self):             # <<<<<<<<<<<<<<
 *         """ Saves dataset as HDF5.
 * 
 */
  __pyx_tuple__117 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_datasets_path, __pyx_n_s_file_path, __pyx_n_s_f); if (unlikely(!__pyx_tuple__117)) __PYX_ERR(0, 582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__117);
  __Pyx_GIVEREF(__pyx_tuple__117);
  __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__117, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_save, 582, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 582, __pyx_L1_error)

  /* "minari/dataset.pyx":618
 * 
 *     @classmethod
 *     def load(cls, fname):             # <<<<<<<<<<<<<<
 *         """ Loads dataset from HDF5.
 * 
 */
  __pyx_tuple__118 = PyTuple_Pack(19, __pyx_n_s_cls, __pyx_n_s_fname, __pyx_n_s_f, __pyx_n_s_dataset_name, __pyx_n_s_algorithm_name, __pyx_n_s_environment_name, __pyx_n_s_environment_stack, __pyx_n_s_seed_used, __pyx_n_s_code_permalink, __pyx_n_s_author, __pyx_n_s_author_email, __pyx_n_s_observations, __pyx_n_s_actions, __pyx_n_s_rewards, __pyx_n_s_terminations, __pyx_n_s_truncations, __pyx_n_s_discrete_action, __pyx_n_s_episode_terminals, __pyx_n_s_dataset); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(0, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__118);
  __Pyx_GIVEREF(__pyx_tuple__118);
  __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(2, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_load, 618, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 618, __pyx_L1_error)

  /* "minari/dataset.pyx":686
 *         return dataset
 * 
 *     def build_episodes(self):             # <<<<<<<<<<<<<<
 *         """ Builds episode objects.
 * 
 */
  __pyx_tuple__119 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__119)) __PYX_ERR(0, 686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__119);
  __Pyx_GIVEREF(__pyx_tuple__119);
  __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__119, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_build_episodes, 686, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 686, __pyx_L1_error)

  /* "minari/dataset.pyx":704
 *         )
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size()
 * 
 */
  __pyx_tuple__120 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__120)) __PYX_ERR(0, 704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__120);
  __Pyx_GIVEREF(__pyx_tuple__120);
  __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__120, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_len, 704, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 704, __pyx_L1_error)

  /* "minari/dataset.pyx":707
 *         return self.size()
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         return self.episodes[index]
 * 
 */
  __pyx_tuple__121 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_index); if (unlikely(!__pyx_tuple__121)) __PYX_ERR(0, 707, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__121);
  __Pyx_GIVEREF(__pyx_tuple__121);
  __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__121, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_getitem, 707, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 707, __pyx_L1_error)

  /* "minari/dataset.pyx":710
 *         return self.episodes[index]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.episodes)
 * 
 */
  __pyx_tuple__122 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__122)) __PYX_ERR(0, 710, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__122);
  __Pyx_GIVEREF(__pyx_tuple__122);
  __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__122, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_iter, 710, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 710, __pyx_L1_error)

  /* "minari/dataset.pyx":746
 * 
 *     """
 *     def __init__(             # <<<<<<<<<<<<<<
 *         self,
 *         observation_shape,
 */
  __pyx_tuple__123 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_observation_shape, __pyx_n_s_action_size, __pyx_n_s_observations, __pyx_n_s_actions, __pyx_n_s_rewards, __pyx_n_s_termination, __pyx_n_s_truncation); if (unlikely(!__pyx_tuple__123)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__123);
  __Pyx_GIVEREF(__pyx_tuple__123);
  __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(8, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__123, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_init, 746, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 746, __pyx_L1_error)
  __pyx_tuple__124 = PyTuple_Pack(2, ((PyObject *)Py_True), ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__124);
  __Pyx_GIVEREF(__pyx_tuple__124);

  /* "minari/dataset.pyx":782
 * 
 *     @property
 *     def observations(self):             # <<<<<<<<<<<<<<
 *         """ Returns the observations.
 * 
 */
  __pyx_tuple__125 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__125)) __PYX_ERR(0, 782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__125);
  __Pyx_GIVEREF(__pyx_tuple__125);
  __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__125, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_observations, 782, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 782, __pyx_L1_error)

  /* "minari/dataset.pyx":792
 * 
 *     @property
 *     def actions(self):             # <<<<<<<<<<<<<<
 *         """ Returns the actions.
 * 
 */
  __pyx_tuple__126 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__126)) __PYX_ERR(0, 792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__126);
  __Pyx_GIVEREF(__pyx_tuple__126);
  __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__126, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_actions, 792, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(0, 792, __pyx_L1_error)

  /* "minari/dataset.pyx":802
 * 
 *     @property
 *     def rewards(self):             # <<<<<<<<<<<<<<
 *         """ Returns the rewards.
 * 
 */
  __pyx_tuple__127 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__127)) __PYX_ERR(0, 802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__127);
  __Pyx_GIVEREF(__pyx_tuple__127);
  __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__127, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_rewards, 802, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 802, __pyx_L1_error)

  /* "minari/dataset.pyx":812
 * 
 *     @property
 *     def termination(self):             # <<<<<<<<<<<<<<
 *         """ Returns the termination flag.
 * 
 */
  __pyx_tuple__128 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__128)) __PYX_ERR(0, 812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__128);
  __Pyx_GIVEREF(__pyx_tuple__128);
  __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__128, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_termination, 812, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 812, __pyx_L1_error)

  /* "minari/dataset.pyx":822
 * 
 *     @property
 *     def truncation(self):             # <<<<<<<<<<<<<<
 *         """ Returns the truncation flag.
 * 
 */
  __pyx_tuple__129 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__129)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__129);
  __Pyx_GIVEREF(__pyx_tuple__129);
  __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__129, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_truncation, 822, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 822, __pyx_L1_error)

  /* "minari/dataset.pyx":832
 * 
 *     @property
 *     def transitions(self):             # <<<<<<<<<<<<<<
 *         """ Returns the transitions.
 * 
 */
  __pyx_tuple__130 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__130)) __PYX_ERR(0, 832, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__130);
  __Pyx_GIVEREF(__pyx_tuple__130);
  __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__130, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_transitions_2, 832, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 832, __pyx_L1_error)

  /* "minari/dataset.pyx":844
 *         return self._transitions
 * 
 *     def build_transitions(self):             # <<<<<<<<<<<<<<
 *         """ Builds transition objects.
 * 
 */
  __pyx_tuple__131 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__131)) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__131);
  __Pyx_GIVEREF(__pyx_tuple__131);
  __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__131, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_build_transitions, 844, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 844, __pyx_L1_error)

  /* "minari/dataset.pyx":861
 *         )
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         """ Returns the number of transitions.
 * 
 */
  __pyx_tuple__132 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__132)) __PYX_ERR(0, 861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__132);
  __Pyx_GIVEREF(__pyx_tuple__132);
  __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__132, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_size, 861, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(0, 861, __pyx_L1_error)

  /* "minari/dataset.pyx":870
 *         return len(self.transitions)
 * 
 *     def get_observation_shape(self):             # <<<<<<<<<<<<<<
 *         """ Returns observation shape.
 * 
 */
  __pyx_tuple__133 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__133)) __PYX_ERR(0, 870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__133);
  __Pyx_GIVEREF(__pyx_tuple__133);
  __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__133, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_get_observation_shape, 870, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 870, __pyx_L1_error)

  /* "minari/dataset.pyx":879
 *         return self.observation_shape
 * 
 *     def get_action_size(self):             # <<<<<<<<<<<<<<
 *         """ Returns dimension of action-space.
 * 
 */
  __pyx_tuple__134 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__134)) __PYX_ERR(0, 879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__134);
  __Pyx_GIVEREF(__pyx_tuple__134);
  __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__134, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_get_action_size, 879, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(0, 879, __pyx_L1_error)

  /* "minari/dataset.pyx":888
 *         return self.action_size
 * 
 *     def compute_return(self):             # <<<<<<<<<<<<<<
 *         """ Computes sum of rewards.
 * 
 */
  __pyx_tuple__135 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__135)) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__135);
  __Pyx_GIVEREF(__pyx_tuple__135);
  __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__135, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_compute_return, 888, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 888, __pyx_L1_error)

  /* "minari/dataset.pyx":901
 *         return np.sum(self._rewards)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size()
 * 
 */
  __pyx_tuple__136 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__136)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__136);
  __Pyx_GIVEREF(__pyx_tuple__136);
  __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__136, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_len, 901, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 901, __pyx_L1_error)

  /* "minari/dataset.pyx":904
 *         return self.size()
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         return self.transitions[index]
 * 
 */
  __pyx_tuple__137 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_index); if (unlikely(!__pyx_tuple__137)) __PYX_ERR(0, 904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__137);
  __Pyx_GIVEREF(__pyx_tuple__137);
  __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__137, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_getitem, 904, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 904, __pyx_L1_error)

  /* "minari/dataset.pyx":907
 *         return self.transitions[index]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.transitions)
 * 
 */
  __pyx_tuple__138 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__138)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__138);
  __Pyx_GIVEREF(__pyx_tuple__138);
  __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__138, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_iter, 907, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(0, 907, __pyx_L1_error)

  /* "minari/dataset.pyx":1021
 *         return self._thisptr
 * 
 *     def get_observation_shape(self):             # <<<<<<<<<<<<<<
 *         """ Returns observation shape.
 * 
 */
  __pyx_tuple__139 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__139)) __PYX_ERR(0, 1021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__139);
  __Pyx_GIVEREF(__pyx_tuple__139);
  __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__139, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_get_observation_shape, 1021, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 1021, __pyx_L1_error)

  /* "minari/dataset.pyx":1030
 *         return tuple(self._thisptr.get().observation_shape)
 * 
 *     def get_action_size(self):             # <<<<<<<<<<<<<<
 *         """ Returns dimension of action-space.
 * 
 */
  __pyx_tuple__140 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__140)) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__140);
  __Pyx_GIVEREF(__pyx_tuple__140);
  __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__140, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_get_action_size, 1030, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(0, 1030, __pyx_L1_error)

  /* "minari/dataset.pyx":1161
 *         self._next_transition = transition
 * 
 *     def clear_links(self):             # <<<<<<<<<<<<<<
 *         """ Clears links to the next and previous transitions.
 * 
 */
  __pyx_tuple__141 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__141)) __PYX_ERR(0, 1161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__141);
  __Pyx_GIVEREF(__pyx_tuple__141);
  __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__141, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_clear_links, 1161, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 1161, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */
  __pyx_tuple__142 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__142)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__142);
  __Pyx_GIVEREF(__pyx_tuple__142);
  __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__142, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(1, 1, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__143 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__143)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__143);
  __Pyx_GIVEREF(__pyx_tuple__143);
  __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__143, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(1, 3, __pyx_L1_error)

  /* "minari/dataset.pyx":1173
 * 
 * 
 * def trace_back_and_clear(transition):             # <<<<<<<<<<<<<<
 *     """ Traces transitions and clear all links.
 * 
 */
  __pyx_tuple__144 = PyTuple_Pack(2, __pyx_n_s_transition, __pyx_n_s_prev_transition); if (unlikely(!__pyx_tuple__144)) __PYX_ERR(0, 1173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__144);
  __Pyx_GIVEREF(__pyx_tuple__144);
  __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__144, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_trace_back_and_clear, 1173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(0, 1173, __pyx_L1_error)

  /* "minari/dataset.pyx":1570
 *         return self._transitions
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         """ Returns size of mini-batch.
 * 
 */
  __pyx_tuple__145 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__145)) __PYX_ERR(0, 1570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__145);
  __Pyx_GIVEREF(__pyx_tuple__145);
  __pyx_codeobj__81 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__145, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_minari_dataset_pyx, __pyx_n_s_size, 1570, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__81)) __PYX_ERR(0, 1570, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */
  __pyx_tuple__146 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__146)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__146);
  __Pyx_GIVEREF(__pyx_tuple__146);
  __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__146, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(1, 1, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__147 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__147)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__147);
  __Pyx_GIVEREF(__pyx_tuple__147);
  __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__147, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  /* InitThreads.init */
  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0
PyEval_InitThreads();
#endif

if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)

  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __pyx_vtabptr_6minari_7dataset_Transition = &__pyx_vtable_6minari_7dataset_Transition;
  __pyx_vtable_6minari_7dataset_Transition.get_ptr = (__pyx_t_6minari_7dataset_TransitionPtr (*)(struct __pyx_obj_6minari_7dataset_Transition *))__pyx_f_6minari_7dataset_10Transition_get_ptr;
  if (PyType_Ready(&__pyx_type_6minari_7dataset_Transition) < 0) __PYX_ERR(0, 917, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6minari_7dataset_Transition.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6minari_7dataset_Transition.tp_dictoffset && __pyx_type_6minari_7dataset_Transition.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6minari_7dataset_Transition.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_6minari_7dataset_Transition.tp_dict, __pyx_vtabptr_6minari_7dataset_Transition) < 0) __PYX_ERR(0, 917, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Transition, (PyObject *)&__pyx_type_6minari_7dataset_Transition) < 0) __PYX_ERR(0, 917, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6minari_7dataset_Transition) < 0) __PYX_ERR(0, 917, __pyx_L1_error)
  __pyx_ptype_6minari_7dataset_Transition = &__pyx_type_6minari_7dataset_Transition;
  __pyx_vtabptr_6minari_7dataset_TransitionMiniBatch = &__pyx_vtable_6minari_7dataset_TransitionMiniBatch;
  __pyx_vtable_6minari_7dataset_TransitionMiniBatch._assign_observation = (void (*)(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *, int, __pyx_t_6minari_7dataset_TransitionPtr, void *, int, bool, bool))__pyx_f_6minari_7dataset_19TransitionMiniBatch__assign_observation;
  __pyx_vtable_6minari_7dataset_TransitionMiniBatch._assign_action = (void (*)(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *, int, __pyx_t_6minari_7dataset_TransitionPtr, void *, bool))__pyx_f_6minari_7dataset_19TransitionMiniBatch__assign_action;
  __pyx_vtable_6minari_7dataset_TransitionMiniBatch._assign_to_batch = (void (*)(struct __pyx_obj_6minari_7dataset_TransitionMiniBatch *, int, __pyx_t_6minari_7dataset_TransitionPtr, void *, void *, float *, void *, float *, float *, float *, int, int, float, bool, bool))__pyx_f_6minari_7dataset_19TransitionMiniBatch__assign_to_batch;
  if (PyType_Ready(&__pyx_type_6minari_7dataset_TransitionMiniBatch) < 0) __PYX_ERR(0, 1236, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6minari_7dataset_TransitionMiniBatch.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6minari_7dataset_TransitionMiniBatch.tp_dictoffset && __pyx_type_6minari_7dataset_TransitionMiniBatch.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6minari_7dataset_TransitionMiniBatch.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_6minari_7dataset_TransitionMiniBatch.tp_dict, __pyx_vtabptr_6minari_7dataset_TransitionMiniBatch) < 0) __PYX_ERR(0, 1236, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_TransitionMiniBatch, (PyObject *)&__pyx_type_6minari_7dataset_TransitionMiniBatch) < 0) __PYX_ERR(0, 1236, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6minari_7dataset_TransitionMiniBatch) < 0) __PYX_ERR(0, 1236, __pyx_L1_error)
  __pyx_ptype_6minari_7dataset_TransitionMiniBatch = &__pyx_type_6minari_7dataset_TransitionMiniBatch;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", 
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 199, __pyx_L1_error)
  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 222, __pyx_L1_error)
  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 226, __pyx_L1_error)
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 238, __pyx_L1_error)
  __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_generic) __PYX_ERR(2, 770, __pyx_L1_error)
  __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_number) __PYX_ERR(2, 772, __pyx_L1_error)
  __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_integer) __PYX_ERR(2, 774, __pyx_L1_error)
  __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 776, __pyx_L1_error)
  __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 778, __pyx_L1_error)
  __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 780, __pyx_L1_error)
  __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_floating) __PYX_ERR(2, 782, __pyx_L1_error)
  __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 784, __pyx_L1_error)
  __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 786, __pyx_L1_error)
  __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5numpy_character) __PYX_ERR(2, 788, __pyx_L1_error)
  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
   if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 826, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#ifndef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#elif PY_MAJOR_VERSION < 3
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" void
#else
#define __Pyx_PyMODINIT_FUNC void
#endif
#else
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initdataset(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initdataset(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_dataset(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_dataset(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_dataset(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  __Pyx_TraceDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'dataset' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
  PyErr_Clear();
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  if (!__Pyx_RefNanny)
      Py_FatalError("failed to import 'refnanny' module");
}
#endif
  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_dataset(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  PyEval_InitThreads();
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("dataset", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_minari__dataset) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "minari.dataset")) {
      if (unlikely(PyDict_SetItemString(modules, "minari.dataset", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  (void)__Pyx_modinit_function_export_code();
  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code();
  (void)__Pyx_modinit_function_import_code();
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __Pyx_TraceCall("__Pyx_PyMODINIT_FUNC PyInit_dataset(void)", __pyx_f[0], 1, 0, __PYX_ERR(0, 1, __pyx_L1_error));

  /* "minari/dataset.pyx":1
 * import os             # <<<<<<<<<<<<<<
 * import warnings
 * from pathlib import Path
 */
  __Pyx_TraceLine(1,0,__PYX_ERR(0, 1, __pyx_L1_error))
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":2
 * import os
 * import warnings             # <<<<<<<<<<<<<<
 * from pathlib import Path
 * 
 */
  __Pyx_TraceLine(2,0,__PYX_ERR(0, 2, __pyx_L1_error))
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":3
 * import os
 * import warnings
 * from pathlib import Path             # <<<<<<<<<<<<<<
 * 
 * import numpy as np
 */
  __Pyx_TraceLine(3,0,__PYX_ERR(0, 3, __pyx_L1_error))
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_Path);
  __Pyx_GIVEREF(__pyx_n_s_Path);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Path);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_pathlib, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Path, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":5
 * from pathlib import Path
 * 
 * import numpy as np             # <<<<<<<<<<<<<<
 * 
 * cimport numpy as np
 */
  __Pyx_TraceLine(5,0,__PYX_ERR(0, 5, __pyx_L1_error))
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":10
 * 
 * import cython
 * import h5py             # <<<<<<<<<<<<<<
 * from cython.parallel import prange
 * 
 */
  __Pyx_TraceLine(10,0,__PYX_ERR(0, 10, __pyx_L1_error))
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_h5py, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_h5py, __pyx_t_2) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":19
 * from minari.dataset cimport CTransition
 * 
 * from .logger import LOG             # <<<<<<<<<<<<<<
 * 
 * # (o_t, a_t, r_t, t_t)
 */
  __Pyx_TraceLine(19,0,__PYX_ERR(0, 19, __pyx_L1_error))
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_LOG);
  __Pyx_GIVEREF(__pyx_n_s_LOG);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_LOG);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_logger, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_LOG); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LOG, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":35
 * 
 * 
 * def _safe_size(array):             # <<<<<<<<<<<<<<
 *     if isinstance(array, (list, tuple)):
 *         return len(array)
 */
  __Pyx_TraceLine(35,0,__PYX_ERR(0, 35, __pyx_L1_error))
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_1_safe_size, 0, __pyx_n_s_safe_size, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_safe_size, __pyx_t_1) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":43
 * 
 * 
 * def _to_episodes(             # <<<<<<<<<<<<<<
 *     observation_shape,
 *     action_size,
 */
  __Pyx_TraceLine(43,0,__PYX_ERR(0, 43, __pyx_L1_error))
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_3_to_episodes, 0, __pyx_n_s_to_episodes, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_to_episodes, __pyx_t_1) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":71
 * 
 * 
 * def _to_transitions(             # <<<<<<<<<<<<<<
 *     observation_shape,
 *     action_size,
 */
  __Pyx_TraceLine(71,0,__PYX_ERR(0, 71, __pyx_L1_error))
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_5_to_transitions, 0, __pyx_n_s_to_transitions, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_to_transitions, __pyx_t_1) < 0) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":120
 * 
 * 
 * def _check_discrete_action(actions):             # <<<<<<<<<<<<<<
 *     float_actions = np.array(actions, dtype=np.float32)
 *     int_actions = np.array(actions, dtype=np.int32)
 */
  __Pyx_TraceLine(120,0,__PYX_ERR(0, 120, __pyx_L1_error))
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_7_check_discrete_action, 0, __pyx_n_s_check_discrete_action, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__4)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_discrete_action, __pyx_t_1) < 0) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":126
 * 
 * 
 * class MinariDataset:             # <<<<<<<<<<<<<<
 *     """ Markov-Decision Process Dataset class.
 * 
 */
  __Pyx_TraceLine(126,0,__PYX_ERR(0, 126, __pyx_L1_error))
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_MinariDataset, __pyx_n_s_MinariDataset, (PyObject *) NULL, __pyx_n_s_minari_dataset, __pyx_kp_s_Markov_Decision_Process_Dataset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "minari/dataset.pyx":185
 * 
 *     """
 *     def __init__(             # <<<<<<<<<<<<<<
 *         self,
 *         dataset_name,
 */
  __Pyx_TraceLine(185,0,__PYX_ERR(0, 185, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_1__init__, 0, __pyx_n_s_MinariDataset___init, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__93);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":264
 * 
 *     @property
 *     def dataset_name(self):             # <<<<<<<<<<<<<<
 *         return self._dataset_name
 * 
 */
  __Pyx_TraceLine(264,0,__PYX_ERR(0, 264, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_3dataset_name, 0, __pyx_n_s_MinariDataset_dataset_name, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "minari/dataset.pyx":263
 *         self._episodes = None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def dataset_name(self):
 *         return self._dataset_name
 */
  __Pyx_TraceLine(263,0,__PYX_ERR(0, 263, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_dataset_name, __pyx_t_3) < 0) __PYX_ERR(0, 264, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":268
 * 
 *     @property
 *     def algorithm_name(self):             # <<<<<<<<<<<<<<
 *         return self._algorithm_name
 * 
 */
  __Pyx_TraceLine(268,0,__PYX_ERR(0, 268, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_5algorithm_name, 0, __pyx_n_s_MinariDataset_algorithm_name, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "minari/dataset.pyx":267
 *         return self._dataset_name
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def algorithm_name(self):
 *         return self._algorithm_name
 */
  __Pyx_TraceLine(267,0,__PYX_ERR(0, 267, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_algorithm_name, __pyx_t_2) < 0) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":272
 * 
 *     @property
 *     def environment_name(self):             # <<<<<<<<<<<<<<
 *         return self._environment_name
 * 
 */
  __Pyx_TraceLine(272,0,__PYX_ERR(0, 272, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_7environment_name, 0, __pyx_n_s_MinariDataset_environment_name, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "minari/dataset.pyx":271
 *         return self._algorithm_name
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def environment_name(self):
 *         return self._environment_name
 */
  __Pyx_TraceLine(271,0,__PYX_ERR(0, 271, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_environment_name, __pyx_t_3) < 0) __PYX_ERR(0, 272, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":276
 * 
 *     @property
 *     def environment_stack(self):             # <<<<<<<<<<<<<<
 *         return self._environment_stack
 * 
 */
  __Pyx_TraceLine(276,0,__PYX_ERR(0, 276, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_9environment_stack, 0, __pyx_n_s_MinariDataset_environment_stack, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "minari/dataset.pyx":275
 *         return self._environment_name
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def environment_stack(self):
 *         return self._environment_stack
 */
  __Pyx_TraceLine(275,0,__PYX_ERR(0, 275, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_environment_stack, __pyx_t_2) < 0) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":280
 * 
 *     @property
 *     def seed_used(self):             # <<<<<<<<<<<<<<
 *         return self._seed_used
 * 
 */
  __Pyx_TraceLine(280,0,__PYX_ERR(0, 280, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_11seed_used, 0, __pyx_n_s_MinariDataset_seed_used, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "minari/dataset.pyx":279
 *         return self._environment_stack
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def seed_used(self):
 *         return self._seed_used
 */
  __Pyx_TraceLine(279,0,__PYX_ERR(0, 279, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_seed_used, __pyx_t_3) < 0) __PYX_ERR(0, 280, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":284
 * 
 *     @property
 *     def code_permalink(self):             # <<<<<<<<<<<<<<
 *         return self._code_permalink
 * 
 */
  __Pyx_TraceLine(284,0,__PYX_ERR(0, 284, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_13code_permalink, 0, __pyx_n_s_MinariDataset_code_permalink, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "minari/dataset.pyx":283
 *         return self._seed_used
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def code_permalink(self):
 *         return self._code_permalink
 */
  __Pyx_TraceLine(283,0,__PYX_ERR(0, 283, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_code_permalink, __pyx_t_2) < 0) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":288
 * 
 *     @property
 *     def author(self):             # <<<<<<<<<<<<<<
 *         return self._author
 * 
 */
  __Pyx_TraceLine(288,0,__PYX_ERR(0, 288, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_15author, 0, __pyx_n_s_MinariDataset_author, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "minari/dataset.pyx":287
 *         return self._code_permalink
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def author(self):
 *         return self._author
 */
  __Pyx_TraceLine(287,0,__PYX_ERR(0, 287, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_author, __pyx_t_3) < 0) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":292
 * 
 *     @property
 *     def author_email(self):             # <<<<<<<<<<<<<<
 *         return self._author_email
 * 
 */
  __Pyx_TraceLine(292,0,__PYX_ERR(0, 292, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_17author_email, 0, __pyx_n_s_MinariDataset_author_email, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "minari/dataset.pyx":291
 *         return self._author
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def author_email(self):
 *         return self._author_email
 */
  __Pyx_TraceLine(291,0,__PYX_ERR(0, 291, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_author_email, __pyx_t_2) < 0) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":296
 * 
 *     @property
 *     def observations(self):             # <<<<<<<<<<<<<<
 *         """ Returns the observations.
 * 
 */
  __Pyx_TraceLine(296,0,__PYX_ERR(0, 296, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_19observations, 0, __pyx_n_s_MinariDataset_observations, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "minari/dataset.pyx":295
 *         return self._author_email
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def observations(self):
 *         """ Returns the observations.
 */
  __Pyx_TraceLine(295,0,__PYX_ERR(0, 295, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_observations, __pyx_t_3) < 0) __PYX_ERR(0, 296, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":306
 * 
 *     @property
 *     def actions(self):             # <<<<<<<<<<<<<<
 *         """ Returns the actions.
 * 
 */
  __Pyx_TraceLine(306,0,__PYX_ERR(0, 306, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_21actions, 0, __pyx_n_s_MinariDataset_actions, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "minari/dataset.pyx":305
 *         return self._observations
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def actions(self):
 *         """ Returns the actions.
 */
  __Pyx_TraceLine(305,0,__PYX_ERR(0, 305, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_actions, __pyx_t_2) < 0) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":316
 * 
 *     @property
 *     def rewards(self):             # <<<<<<<<<<<<<<
 *         """ Returns the rewards.
 * 
 */
  __Pyx_TraceLine(316,0,__PYX_ERR(0, 316, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_23rewards, 0, __pyx_n_s_MinariDataset_rewards, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "minari/dataset.pyx":315
 *         return self._actions
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def rewards(self):
 *         """ Returns the rewards.
 */
  __Pyx_TraceLine(315,0,__PYX_ERR(0, 315, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_rewards, __pyx_t_3) < 0) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":326
 * 
 *     @property
 *     def terminations(self):             # <<<<<<<<<<<<<<
 *         """ Returns the terminations flags.
 * 
 */
  __Pyx_TraceLine(326,0,__PYX_ERR(0, 326, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_25terminations, 0, __pyx_n_s_MinariDataset_terminations, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "minari/dataset.pyx":325
 *         return self._rewards
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def terminations(self):
 *         """ Returns the terminations flags.
 */
  __Pyx_TraceLine(325,0,__PYX_ERR(0, 325, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_terminations, __pyx_t_2) < 0) __PYX_ERR(0, 326, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":336
 * 
 *     @property
 *     def truncations(self):             # <<<<<<<<<<<<<<
 *         """ Returns the terminations flags.
 * 
 */
  __Pyx_TraceLine(336,0,__PYX_ERR(0, 336, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_27truncations, 0, __pyx_n_s_MinariDataset_truncations, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "minari/dataset.pyx":335
 *         return self._terminations
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def truncations(self):
 *         """ Returns the terminations flags.
 */
  __Pyx_TraceLine(335,0,__PYX_ERR(0, 335, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_truncations, __pyx_t_3) < 0) __PYX_ERR(0, 336, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":345
 *         return self._truncations
 *     @property
 *     def episode_terminals(self):             # <<<<<<<<<<<<<<
 *         """ Returns the episode terminal flags.
 * 
 */
  __Pyx_TraceLine(345,0,__PYX_ERR(0, 345, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_29episode_terminals, 0, __pyx_n_s_MinariDataset_episode_terminals, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "minari/dataset.pyx":344
 *         """
 *         return self._truncations
 *     @property             # <<<<<<<<<<<<<<
 *     def episode_terminals(self):
 *         """ Returns the episode terminal flags.
 */
  __Pyx_TraceLine(344,0,__PYX_ERR(0, 344, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_episode_terminals, __pyx_t_2) < 0) __PYX_ERR(0, 345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":355
 * 
 *     @property
 *     def episodes(self):             # <<<<<<<<<<<<<<
 *         """ Returns the episodes.
 * 
 */
  __Pyx_TraceLine(355,0,__PYX_ERR(0, 355, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_31episodes, 0, __pyx_n_s_MinariDataset_episodes, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "minari/dataset.pyx":354
 *         return self._episode_terminals
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def episodes(self):
 *         """ Returns the episodes.
 */
  __Pyx_TraceLine(354,0,__PYX_ERR(0, 354, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_episodes_2, __pyx_t_3) < 0) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":367
 *         return self._episodes
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         """ Returns the number of episodes in the dataset.
 * 
 */
  __Pyx_TraceLine(367,0,__PYX_ERR(0, 367, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_33size, 0, __pyx_n_s_MinariDataset_size, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_size, __pyx_t_3) < 0) __PYX_ERR(0, 367, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":376
 *         return len(self.episodes)
 * 
 *     def get_action_size(self):             # <<<<<<<<<<<<<<
 *         """ Returns dimension of action-space.
 * 
 */
  __Pyx_TraceLine(376,0,__PYX_ERR(0, 376, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_35get_action_size, 0, __pyx_n_s_MinariDataset_get_action_size, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_action_size, __pyx_t_3) < 0) __PYX_ERR(0, 376, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":390
 *         return self._actions.shape[1]
 * 
 *     def get_observation_shape(self):             # <<<<<<<<<<<<<<
 *         """ Returns observation shape.
 * 
 */
  __Pyx_TraceLine(390,0,__PYX_ERR(0, 390, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_37get_observation_shape, 0, __pyx_n_s_MinariDataset_get_observation_sh, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_observation_shape, __pyx_t_3) < 0) __PYX_ERR(0, 390, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":399
 *         return self._observations[0].shape
 * 
 *     def is_action_discrete(self):             # <<<<<<<<<<<<<<
 *         """ Returns `discrete_action` flag.
 * 
 */
  __Pyx_TraceLine(399,0,__PYX_ERR(0, 399, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_39is_action_discrete, 0, __pyx_n_s_MinariDataset_is_action_discrete, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_is_action_discrete, __pyx_t_3) < 0) __PYX_ERR(0, 399, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":408
 *         return self.discrete_action
 * 
 *     def compute_stats(self):             # <<<<<<<<<<<<<<
 *         """ Computes statistics of the dataset.
 * 
 */
  __Pyx_TraceLine(408,0,__PYX_ERR(0, 408, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_41compute_stats, 0, __pyx_n_s_MinariDataset_compute_stats, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_compute_stats, __pyx_t_3) < 0) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":496
 *         return stats
 * 
 *     def append(             # <<<<<<<<<<<<<<
 *         self,
 *         observations,
 */
  __Pyx_TraceLine(496,0,__PYX_ERR(0, 496, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_43append, 0, __pyx_n_s_MinariDataset_append, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__115);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_append, __pyx_t_3) < 0) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":561
 *         self._episodes = episodes
 * 
 *     def extend(self, dataset):             # <<<<<<<<<<<<<<
 *         """ Extend dataset by another dataset.
 * 
 */
  __Pyx_TraceLine(561,0,__PYX_ERR(0, 561, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_45extend, 0, __pyx_n_s_MinariDataset_extend, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_extend, __pyx_t_3) < 0) __PYX_ERR(0, 561, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":582
 *         )
 * 
 *     def save(self):             # <<<<<<<<<<<<<<
 *         """ Saves dataset as HDF5.
 * 
 */
  __Pyx_TraceLine(582,0,__PYX_ERR(0, 582, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_47save, 0, __pyx_n_s_MinariDataset_save, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_save, __pyx_t_3) < 0) __PYX_ERR(0, 582, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":618
 * 
 *     @classmethod
 *     def load(cls, fname):             # <<<<<<<<<<<<<<
 *         """ Loads dataset from HDF5.
 * 
 */
  __Pyx_TraceLine(618,0,__PYX_ERR(0, 618, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_49load, __Pyx_CYFUNCTION_CLASSMETHOD, __pyx_n_s_MinariDataset_load, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "minari/dataset.pyx":617
 *             f.flush()
 * 
 *     @classmethod             # <<<<<<<<<<<<<<
 *     def load(cls, fname):
 *         """ Loads dataset from HDF5.
 */
  __Pyx_TraceLine(617,0,__PYX_ERR(0, 617, __pyx_L1_error))
  __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_load, __pyx_t_2) < 0) __PYX_ERR(0, 618, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":686
 *         return dataset
 * 
 *     def build_episodes(self):             # <<<<<<<<<<<<<<
 *         """ Builds episode objects.
 * 
 */
  __Pyx_TraceLine(686,0,__PYX_ERR(0, 686, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_51build_episodes, 0, __pyx_n_s_MinariDataset_build_episodes, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_build_episodes, __pyx_t_2) < 0) __PYX_ERR(0, 686, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":704
 *         )
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size()
 * 
 */
  __Pyx_TraceLine(704,0,__PYX_ERR(0, 704, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_53__len__, 0, __pyx_n_s_MinariDataset___len, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_len, __pyx_t_2) < 0) __PYX_ERR(0, 704, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":707
 *         return self.size()
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         return self.episodes[index]
 * 
 */
  __Pyx_TraceLine(707,0,__PYX_ERR(0, 707, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_55__getitem__, 0, __pyx_n_s_MinariDataset___getitem, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 707, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_getitem, __pyx_t_2) < 0) __PYX_ERR(0, 707, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":710
 *         return self.episodes[index]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.episodes)
 * 
 */
  __Pyx_TraceLine(710,0,__PYX_ERR(0, 710, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_13MinariDataset_57__iter__, 0, __pyx_n_s_MinariDataset___iter, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__57)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 710, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_iter, __pyx_t_2) < 0) __PYX_ERR(0, 710, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":126
 * 
 * 
 * class MinariDataset:             # <<<<<<<<<<<<<<
 *     """ Markov-Decision Process Dataset class.
 * 
 */
  __Pyx_TraceLine(126,0,__PYX_ERR(0, 126, __pyx_L1_error))
  __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_MinariDataset, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MinariDataset, __pyx_t_2) < 0) __PYX_ERR(0, 126, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":714
 * 
 * 
 * class Episode:             # <<<<<<<<<<<<<<
 *     """ Episode class.
 * 
 */
  __Pyx_TraceLine(714,0,__PYX_ERR(0, 714, __pyx_L1_error))
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_Episode, __pyx_n_s_Episode, (PyObject *) NULL, __pyx_n_s_minari_dataset, __pyx_kp_s_Episode_class_This_class_is_des); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "minari/dataset.pyx":746
 * 
 *     """
 *     def __init__(             # <<<<<<<<<<<<<<
 *         self,
 *         observation_shape,
 */
  __Pyx_TraceLine(746,0,__PYX_ERR(0, 746, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_7Episode_1__init__, 0, __pyx_n_s_Episode___init, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__58)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__124);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":782
 * 
 *     @property
 *     def observations(self):             # <<<<<<<<<<<<<<
 *         """ Returns the observations.
 * 
 */
  __Pyx_TraceLine(782,0,__PYX_ERR(0, 782, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_7Episode_3observations, 0, __pyx_n_s_Episode_observations, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__59)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "minari/dataset.pyx":781
 *         self._transitions = None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def observations(self):
 *         """ Returns the observations.
 */
  __Pyx_TraceLine(781,0,__PYX_ERR(0, 781, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_observations, __pyx_t_3) < 0) __PYX_ERR(0, 782, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":792
 * 
 *     @property
 *     def actions(self):             # <<<<<<<<<<<<<<
 *         """ Returns the actions.
 * 
 */
  __Pyx_TraceLine(792,0,__PYX_ERR(0, 792, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_7Episode_5actions, 0, __pyx_n_s_Episode_actions, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__60)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "minari/dataset.pyx":791
 *         return self._observations
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def actions(self):
 *         """ Returns the actions.
 */
  __Pyx_TraceLine(791,0,__PYX_ERR(0, 791, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_actions, __pyx_t_2) < 0) __PYX_ERR(0, 792, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":802
 * 
 *     @property
 *     def rewards(self):             # <<<<<<<<<<<<<<
 *         """ Returns the rewards.
 * 
 */
  __Pyx_TraceLine(802,0,__PYX_ERR(0, 802, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_7Episode_7rewards, 0, __pyx_n_s_Episode_rewards, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__61)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "minari/dataset.pyx":801
 *         return self._actions
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def rewards(self):
 *         """ Returns the rewards.
 */
  __Pyx_TraceLine(801,0,__PYX_ERR(0, 801, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_rewards, __pyx_t_3) < 0) __PYX_ERR(0, 802, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":812
 * 
 *     @property
 *     def termination(self):             # <<<<<<<<<<<<<<
 *         """ Returns the termination flag.
 * 
 */
  __Pyx_TraceLine(812,0,__PYX_ERR(0, 812, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_7Episode_9termination, 0, __pyx_n_s_Episode_termination, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "minari/dataset.pyx":811
 *         return self._rewards
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def termination(self):
 *         """ Returns the termination flag.
 */
  __Pyx_TraceLine(811,0,__PYX_ERR(0, 811, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_termination, __pyx_t_2) < 0) __PYX_ERR(0, 812, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":822
 * 
 *     @property
 *     def truncation(self):             # <<<<<<<<<<<<<<
 *         """ Returns the truncation flag.
 * 
 */
  __Pyx_TraceLine(822,0,__PYX_ERR(0, 822, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_7Episode_11truncation, 0, __pyx_n_s_Episode_truncation, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__63)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "minari/dataset.pyx":821
 *         return self._termination
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def truncation(self):
 *         """ Returns the truncation flag.
 */
  __Pyx_TraceLine(821,0,__PYX_ERR(0, 821, __pyx_L1_error))
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_truncation, __pyx_t_3) < 0) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "minari/dataset.pyx":832
 * 
 *     @property
 *     def transitions(self):             # <<<<<<<<<<<<<<
 *         """ Returns the transitions.
 * 
 */
  __Pyx_TraceLine(832,0,__PYX_ERR(0, 832, __pyx_L1_error))
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_7Episode_13transitions, 0, __pyx_n_s_Episode_transitions, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 832, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "minari/dataset.pyx":831
 *         return self._truncation
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def transitions(self):
 *         """ Returns the transitions.
 */
  __Pyx_TraceLine(831,0,__PYX_ERR(0, 831, __pyx_L1_error))
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_transitions_2, __pyx_t_2) < 0) __PYX_ERR(0, 832, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":844
 *         return self._transitions
 * 
 *     def build_transitions(self):             # <<<<<<<<<<<<<<
 *         """ Builds transition objects.
 * 
 */
  __Pyx_TraceLine(844,0,__PYX_ERR(0, 844, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_7Episode_15build_transitions, 0, __pyx_n_s_Episode_build_transitions, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__65)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_build_transitions, __pyx_t_2) < 0) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":861
 *         )
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         """ Returns the number of transitions.
 * 
 */
  __Pyx_TraceLine(861,0,__PYX_ERR(0, 861, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_7Episode_17size, 0, __pyx_n_s_Episode_size, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__66)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_size, __pyx_t_2) < 0) __PYX_ERR(0, 861, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":870
 *         return len(self.transitions)
 * 
 *     def get_observation_shape(self):             # <<<<<<<<<<<<<<
 *         """ Returns observation shape.
 * 
 */
  __Pyx_TraceLine(870,0,__PYX_ERR(0, 870, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_7Episode_19get_observation_shape, 0, __pyx_n_s_Episode_get_observation_shape, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__67)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_observation_shape, __pyx_t_2) < 0) __PYX_ERR(0, 870, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":879
 *         return self.observation_shape
 * 
 *     def get_action_size(self):             # <<<<<<<<<<<<<<
 *         """ Returns dimension of action-space.
 * 
 */
  __Pyx_TraceLine(879,0,__PYX_ERR(0, 879, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_7Episode_21get_action_size, 0, __pyx_n_s_Episode_get_action_size, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__68)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_action_size, __pyx_t_2) < 0) __PYX_ERR(0, 879, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":888
 *         return self.action_size
 * 
 *     def compute_return(self):             # <<<<<<<<<<<<<<
 *         """ Computes sum of rewards.
 * 
 */
  __Pyx_TraceLine(888,0,__PYX_ERR(0, 888, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_7Episode_23compute_return, 0, __pyx_n_s_Episode_compute_return, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_compute_return, __pyx_t_2) < 0) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":901
 *         return np.sum(self._rewards)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size()
 * 
 */
  __Pyx_TraceLine(901,0,__PYX_ERR(0, 901, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_7Episode_25__len__, 0, __pyx_n_s_Episode___len, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_len, __pyx_t_2) < 0) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":904
 *         return self.size()
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         return self.transitions[index]
 * 
 */
  __Pyx_TraceLine(904,0,__PYX_ERR(0, 904, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_7Episode_27__getitem__, 0, __pyx_n_s_Episode___getitem, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__71)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_getitem, __pyx_t_2) < 0) __PYX_ERR(0, 904, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":907
 *         return self.transitions[index]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.transitions)
 * 
 */
  __Pyx_TraceLine(907,0,__PYX_ERR(0, 907, __pyx_L1_error))
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_7Episode_29__iter__, 0, __pyx_n_s_Episode___iter, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__72)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_iter, __pyx_t_2) < 0) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "minari/dataset.pyx":714
 * 
 * 
 * class Episode:             # <<<<<<<<<<<<<<
 *     """ Episode class.
 * 
 */
  __Pyx_TraceLine(714,0,__PYX_ERR(0, 714, __pyx_L1_error))
  __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_Episode, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Episode, __pyx_t_2) < 0) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":1018
 *         self._next_transition = next_transition
 * 
 *     cdef TransitionPtr get_ptr(self):             # <<<<<<<<<<<<<<
 *         return self._thisptr
 * 
 */
  __Pyx_TraceLine(1018,0,__PYX_ERR(0, 1018, __pyx_L1_error))


  /* "minari/dataset.pyx":1021
 *         return self._thisptr
 * 
 *     def get_observation_shape(self):             # <<<<<<<<<<<<<<
 *         """ Returns observation shape.
 * 
 */
  __Pyx_TraceLine(1021,0,__PYX_ERR(0, 1021, __pyx_L1_error))
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_10Transition_3get_observation_shape, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Transition_get_observation_shape, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__73)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6minari_7dataset_Transition->tp_dict, __pyx_n_s_get_observation_shape, __pyx_t_1) < 0) __PYX_ERR(0, 1021, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_6minari_7dataset_Transition);

  /* "minari/dataset.pyx":1030
 *         return tuple(self._thisptr.get().observation_shape)
 * 
 *     def get_action_size(self):             # <<<<<<<<<<<<<<
 *         """ Returns dimension of action-space.
 * 
 */
  __Pyx_TraceLine(1030,0,__PYX_ERR(0, 1030, __pyx_L1_error))
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_10Transition_5get_action_size, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Transition_get_action_size, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6minari_7dataset_Transition->tp_dict, __pyx_n_s_get_action_size, __pyx_t_1) < 0) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_6minari_7dataset_Transition);

  /* "minari/dataset.pyx":1161
 *         self._next_transition = transition
 * 
 *     def clear_links(self):             # <<<<<<<<<<<<<<
 *         """ Clears links to the next and previous transitions.
 * 
 */
  __Pyx_TraceLine(1161,0,__PYX_ERR(0, 1161, __pyx_L1_error))
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_10Transition_7clear_links, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Transition_clear_links, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__75)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6minari_7dataset_Transition->tp_dict, __pyx_n_s_clear_links, __pyx_t_1) < 0) __PYX_ERR(0, 1161, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_6minari_7dataset_Transition);

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */
  __Pyx_TraceLine(1,0,__PYX_ERR(1, 1, __pyx_L1_error))
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_10Transition_9__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Transition___reduce_cython, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__76)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __Pyx_TraceLine(3,0,__PYX_ERR(1, 3, __pyx_L1_error))
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_10Transition_11__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Transition___setstate_cython, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__78)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_1) < 0) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":1173
 * 
 * 
 * def trace_back_and_clear(transition):             # <<<<<<<<<<<<<<
 *     """ Traces transitions and clear all links.
 * 
 */
  __Pyx_TraceLine(1173,0,__PYX_ERR(0, 1173, __pyx_L1_error))
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_9trace_back_and_clear, 0, __pyx_n_s_trace_back_and_clear, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__80)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_trace_back_and_clear, __pyx_t_1) < 0) __PYX_ERR(0, 1173, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":1190
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * cdef void _stack_frames(             # <<<<<<<<<<<<<<
 *     TransitionPtr transition,
 *     UINT8_t* stack,
 */
  __Pyx_TraceLine(1190,0,__PYX_ERR(0, 1190, __pyx_L1_error))


  /* "minari/dataset.pyx":1360
 *             )
 * 
 *     cdef void _assign_observation(             # <<<<<<<<<<<<<<
 *         self,
 *         int batch_index,
 */
  __Pyx_TraceLine(1360,0,__PYX_ERR(0, 1360, __pyx_L1_error))


  /* "minari/dataset.pyx":1407
 *             )
 * 
 *     cdef void _assign_action(             # <<<<<<<<<<<<<<
 *         self,
 *         int batch_index,
 */
  __Pyx_TraceLine(1407,0,__PYX_ERR(0, 1407, __pyx_L1_error))


  /* "minari/dataset.pyx":1427
 *             )
 * 
 *     cdef void _assign_to_batch(             # <<<<<<<<<<<<<<
 *         self,
 *         int batch_index,
 */
  __Pyx_TraceLine(1427,0,__PYX_ERR(0, 1427, __pyx_L1_error))


  /* "minari/dataset.pyx":1570
 *         return self._transitions
 * 
 *     def size(self):             # <<<<<<<<<<<<<<
 *         """ Returns size of mini-batch.
 * 
 */
  __Pyx_TraceLine(1570,0,__PYX_ERR(0, 1570, __pyx_L1_error))
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_19TransitionMiniBatch_3size, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TransitionMiniBatch_size, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__81)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6minari_7dataset_TransitionMiniBatch->tp_dict, __pyx_n_s_size, __pyx_t_1) < 0) __PYX_ERR(0, 1570, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_6minari_7dataset_TransitionMiniBatch);

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */
  __Pyx_TraceLine(1,0,__PYX_ERR(1, 1, __pyx_L1_error))
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_19TransitionMiniBatch_11__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TransitionMiniBatch___reduce_cyt, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__82)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __Pyx_TraceLine(3,0,__PYX_ERR(1, 3, __pyx_L1_error))
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6minari_7dataset_19TransitionMiniBatch_13__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TransitionMiniBatch___setstate_c, NULL, __pyx_n_s_minari_dataset, __pyx_d, ((PyObject *)__pyx_codeobj__84)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_1) < 0) __PYX_ERR(1, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "minari/dataset.pyx":1
 * import os             # <<<<<<<<<<<<<<
 * import warnings
 * from pathlib import Path
 */
  __Pyx_TraceLine(1,0,__PYX_ERR(0, 1, __pyx_L1_error))
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":734
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */
  __Pyx_TraceLine(734,0,__PYX_ERR(2, 734, __pyx_L1_error))


  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":737
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */
  __Pyx_TraceLine(737,0,__PYX_ERR(2, 737, __pyx_L1_error))


  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":740
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */
  __Pyx_TraceLine(740,0,__PYX_ERR(2, 740, __pyx_L1_error))


  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":743
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */
  __Pyx_TraceLine(743,0,__PYX_ERR(2, 743, __pyx_L1_error))


  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":746
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */
  __Pyx_TraceLine(746,0,__PYX_ERR(2, 746, __pyx_L1_error))


  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":749
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape
 */
  __Pyx_TraceLine(749,0,__PYX_ERR(2, 749, __pyx_L1_error))


  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":928
 *     int _import_umath() except -1
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *     Py_INCREF(base) # important to do this before stealing the reference below!
 *     PyArray_SetBaseObject(arr, base)
 */
  __Pyx_TraceLine(928,0,__PYX_ERR(2, 928, __pyx_L1_error))


  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":932
 *     PyArray_SetBaseObject(arr, base)
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     base = PyArray_BASE(arr)
 *     if base is NULL:
 */
  __Pyx_TraceLine(932,0,__PYX_ERR(2, 932, __pyx_L1_error))


  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":940
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         __pyx_import_array()
 */
  __Pyx_TraceLine(940,0,__PYX_ERR(2, 940, __pyx_L1_error))


  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":946
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */
  __Pyx_TraceLine(946,0,__PYX_ERR(2, 946, __pyx_L1_error))


  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":952
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */
  __Pyx_TraceLine(952,0,__PYX_ERR(2, 952, __pyx_L1_error))


  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":966
 * 
 * 
 * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.timedelta64)`
 */
  __Pyx_TraceLine(966,0,__PYX_ERR(2, 966, __pyx_L1_error))


  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":981
 * 
 * 
 * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
 *     """
 *     Cython equivalent of `isinstance(obj, np.datetime64)`
 */
  __Pyx_TraceLine(981,0,__PYX_ERR(2, 981, __pyx_L1_error))


  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":996
 * 
 * 
 * cdef inline npy_datetime get_datetime64_value(object obj) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the int64 value underlying scalar numpy datetime64 object
 */
  __Pyx_TraceLine(996,0,__PYX_ERR(2, 996, __pyx_L1_error))


  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":1006
 * 
 * 
 * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the int64 value underlying scalar numpy timedelta64 object
 */
  __Pyx_TraceLine(1006,0,__PYX_ERR(2, 1006, __pyx_L1_error))


  /* "venv/lib/python3.9/site-packages/numpy/__init__.pxd":1013
 * 
 * 
 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     returns the unit part of the dtype for a numpy datetime64 object.
 */
  __Pyx_TraceLine(1013,0,__PYX_ERR(2, 1013, __pyx_L1_error))


  /* "vector.from_py":45
 * 
 * @cname("__pyx_convert_vector_from_py_int")
 * cdef vector[X] __pyx_convert_vector_from_py_int(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */
  __Pyx_TraceLine(45,0,__PYX_ERR(1, 45, __pyx_L1_error))


  /* "vector.to_py":60
 * 
 * @cname("__pyx_convert_vector_to_py_int")
 * cdef object __pyx_convert_vector_to_py_int(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [v[i] for i in range(v.size())]
 * 
 */
  __Pyx_TraceLine(60,0,__PYX_ERR(1, 60, __pyx_L1_error))

  __Pyx_TraceReturn(Py_None, 0);

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init minari.dataset", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init minari.dataset");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* Profile */
#if CYTHON_PROFILE
static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
                                   PyFrameObject** frame,
                                   PyThreadState* tstate,
                                   const char *funcname,
                                   const char *srcfile,
                                   int firstlineno) {
    PyObject *type, *value, *traceback;
    int retval;
    if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
        if (*code == NULL) {
            *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
            if (*code == NULL) return 0;
        }
        *frame = PyFrame_New(
            tstate,                          /*PyThreadState *tstate*/
            *code,                           /*PyCodeObject *code*/
            __pyx_d,                  /*PyObject *globals*/
            0                                /*PyObject *locals*/
        );
        if (*frame == NULL) return 0;
        if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
            Py_INCREF(Py_None);
            (*frame)->f_trace = Py_None;
        }
#if PY_VERSION_HEX < 0x030400B1
    } else {
        (*frame)->f_tstate = tstate;
#endif
    }
    __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
    retval = 1;
    __Pyx_EnterTracing(tstate);
    __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
    #if CYTHON_TRACE
    if (tstate->c_tracefunc)
        retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
    if (retval && tstate->c_profilefunc)
    #endif
        retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
    __Pyx_LeaveTracing(tstate);
    if (retval) {
        __Pyx_ErrRestoreInState(tstate, type, value, traceback);
        return __Pyx_IsTracing(tstate, 0, 0) && retval;
    } else {
        Py_XDECREF(type);
        Py_XDECREF(value);
        Py_XDECREF(traceback);
        return -1;
    }
}
static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
    PyCodeObject *py_code = 0;
#if PY_MAJOR_VERSION >= 3
    py_code = PyCode_NewEmpty(srcfile, funcname, firstlineno);
    if (likely(py_code)) {
        py_code->co_flags |= CO_OPTIMIZED | CO_NEWLOCALS;
    }
#else
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    py_funcname = PyString_FromString(funcname);
    if (unlikely(!py_funcname)) goto bad;
    py_srcfile = PyString_FromString(srcfile);
    if (unlikely(!py_srcfile)) goto bad;
    py_code = PyCode_New(
        0,
        0,
        0,
        CO_OPTIMIZED | CO_NEWLOCALS,
        __pyx_empty_bytes,     /*PyObject *code,*/
        __pyx_empty_tuple,     /*PyObject *consts,*/
        __pyx_empty_tuple,     /*PyObject *names,*/
        __pyx_empty_tuple,     /*PyObject *varnames,*/
        __pyx_empty_tuple,     /*PyObject *freevars,*/
        __pyx_empty_tuple,     /*PyObject *cellvars,*/
        py_srcfile,       /*PyObject *filename,*/
        py_funcname,      /*PyObject *name,*/
        firstlineno,
        __pyx_empty_bytes      /*PyObject *lnotab*/
    );
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
#endif
    return py_code;
}
#endif

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* RaiseException */
#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = Py_TYPE(func)->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (__Pyx_PyFastCFunction_Check(func)) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* SliceObject */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* PyObjectCallNoArg */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#else
    if (likely(PyCFunction_Check(func)))
#endif
    {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

/* UnpackItemEndCheck */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

/* JoinPyUnicode */
static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      CYTHON_UNUSED Py_UCS4 max_char) {
#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    PyObject *result_uval;
    int result_ukind;
    Py_ssize_t i, char_pos;
    void *result_udata;
#if CYTHON_PEP393_ENABLED
    result_uval = PyUnicode_New(result_ulength, max_char);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
    result_udata = PyUnicode_DATA(result_uval);
#else
    result_uval = PyUnicode_FromUnicode(NULL, result_ulength);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = sizeof(Py_UNICODE);
    result_udata = PyUnicode_AS_UNICODE(result_uval);
#endif
    char_pos = 0;
    for (i=0; i < value_count; i++) {
        int ukind;
        Py_ssize_t ulength;
        void *udata;
        PyObject *uval = PyTuple_GET_ITEM(value_tuple, i);
        if (unlikely(__Pyx_PyUnicode_READY(uval)))
            goto bad;
        ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
        if (unlikely(!ulength))
            continue;
        if (unlikely(char_pos + ulength < 0))
            goto overflow;
        ukind = __Pyx_PyUnicode_KIND(uval);
        udata = __Pyx_PyUnicode_DATA(uval);
        if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) {
            memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind));
        } else {
            #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters)
            _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
            #else
            Py_ssize_t j;
            for (j=0; j < ulength; j++) {
                Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
                __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
            }
            #endif
        }
        char_pos += ulength;
    }
    return result_uval;
overflow:
    PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
bad:
    Py_DECREF(result_uval);
    return NULL;
#else
    result_ulength++;
    value_count++;
    return PyUnicode_Join(__pyx_empty_unicode, value_tuple);
#endif
}

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
    }
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* DictGetItem */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

/* None */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* ArgTypeTest */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* IsLittleEndian */
static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
{
  union {
    uint32_t u32;
    uint8_t u8[4];
  } S;
  S.u32 = 0x01020304;
  return S.u8[0] == 4;
}

/* BufferFormatCheck */
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type) {
  stack[0].field = &ctx->root;
  stack[0].parent_offset = 0;
  ctx->root.type = type;
  ctx->root.name = "buffer dtype";
  ctx->root.offset = 0;
  ctx->head = stack;
  ctx->head->field = &ctx->root;
  ctx->fmt_offset = 0;
  ctx->head->parent_offset = 0;
  ctx->new_packmode = '@';
  ctx->enc_packmode = '@';
  ctx->new_count = 1;
  ctx->enc_count = 0;
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  ctx->is_valid_array = 0;
  ctx->struct_alignment = 0;
  while (type->typegroup == 'S') {
    ++ctx->head;
    ctx->head->field = type->fields;
    ctx->head->parent_offset = 0;
    type = type->fields->type;
  }
}
static int __Pyx_BufFmt_ParseNumber(const char** ts) {
    int count;
    const char* t = *ts;
    if (*t < '0' || *t > '9') {
      return -1;
    } else {
        count = *t++ - '0';
        while (*t >= '0' && *t <= '9') {
            count *= 10;
            count += *t++ - '0';
        }
    }
    *ts = t;
    return count;
}
static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
    int number = __Pyx_BufFmt_ParseNumber(ts);
    if (number == -1)
        PyErr_Format(PyExc_ValueError,\
                     "Does not understand character buffer dtype format string ('%c')", **ts);
    return number;
}
static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  PyErr_Format(PyExc_ValueError,
               "Unexpected format string character: '%c'", ch);
}
static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  switch (ch) {
    case '?': return "'bool'";
    case 'c': return "'char'";
    case 'b': return "'signed char'";
    case 'B': return "'unsigned char'";
    case 'h': return "'short'";
    case 'H': return "'unsigned short'";
    case 'i': return "'int'";
    case 'I': return "'unsigned int'";
    case 'l': return "'long'";
    case 'L': return "'unsigned long'";
    case 'q': return "'long long'";
    case 'Q': return "'unsigned long long'";
    case 'f': return (is_complex ? "'complex float'" : "'float'");
    case 'd': return (is_complex ? "'complex double'" : "'double'");
    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
    case 'T': return "a struct";
    case 'O': return "Python object";
    case 'P': return "a pointer";
    case 's': case 'p': return "a string";
    case 0: return "end";
    default: return "unparseable format string";
  }
}
static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return 2;
    case 'i': case 'I': case 'l': case 'L': return 4;
    case 'q': case 'Q': return 8;
    case 'f': return (is_complex ? 8 : 4);
    case 'd': return (is_complex ? 16 : 8);
    case 'g': {
      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
      return 0;
    }
    case 'O': case 'P': return sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(short);
    case 'i': case 'I': return sizeof(int);
    case 'l': case 'L': return sizeof(long);
    #ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
    #endif
    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
    case 'O': case 'P': return sizeof(void*);
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
typedef struct { char c; short x; } __Pyx_st_short;
typedef struct { char c; int x; } __Pyx_st_int;
typedef struct { char c; long x; } __Pyx_st_long;
typedef struct { char c; float x; } __Pyx_st_float;
typedef struct { char c; double x; } __Pyx_st_double;
typedef struct { char c; long double x; } __Pyx_st_longdouble;
typedef struct { char c; void *x; } __Pyx_st_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
/* These are for computing the padding at the end of the struct to align
   on the first member of the struct. This will probably the same as above,
   but we don't have any guarantees.
 */
typedef struct { short x; char c; } __Pyx_pad_short;
typedef struct { int x; char c; } __Pyx_pad_int;
typedef struct { long x; char c; } __Pyx_pad_long;
typedef struct { float x; char c; } __Pyx_pad_float;
typedef struct { double x; char c; } __Pyx_pad_double;
typedef struct { long double x; char c; } __Pyx_pad_longdouble;
typedef struct { void *x; char c; } __Pyx_pad_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  switch (ch) {
    case 'c':
        return 'H';
    case 'b': case 'h': case 'i':
    case 'l': case 'q': case 's': case 'p':
        return 'I';
    case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
        return 'U';
    case 'f': case 'd': case 'g':
        return (is_complex ? 'C' : 'R');
    case 'O':
        return 'O';
    case 'P':
        return 'P';
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
    const char* expected;
    const char* quote;
    if (ctx->head == NULL) {
      expected = "end";
      quote = "";
    } else {
      expected = ctx->head->field->type->name;
      quote = "'";
    }
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected %s%s%s but got %s",
                 quote, expected, quote,
                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  } else {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_StructField* parent = (ctx->head - 1)->field;
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
                 parent->type->name, field->name);
  }
}
static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  char group;
  size_t size, offset, arraysize = 1;
  if (ctx->enc_type == 0) return 0;
  if (ctx->head->field->type->arraysize[0]) {
    int i, ndim = 0;
    if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
        ctx->is_valid_array = ctx->head->field->type->ndim == 1;
        ndim = 1;
        if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
            PyErr_Format(PyExc_ValueError,
                         "Expected a dimension of size %zu, got %zu",
                         ctx->head->field->type->arraysize[0], ctx->enc_count);
            return -1;
        }
    }
    if (!ctx->is_valid_array) {
      PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
                   ctx->head->field->type->ndim, ndim);
      return -1;
    }
    for (i = 0; i < ctx->head->field->type->ndim; i++) {
      arraysize *= ctx->head->field->type->arraysize[i];
    }
    ctx->is_valid_array = 0;
    ctx->enc_count = 1;
  }
  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  do {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_TypeInfo* type = field->type;
    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
    } else {
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
    }
    if (ctx->enc_packmode == '@') {
      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
      size_t align_mod_offset;
      if (align_at == 0) return -1;
      align_mod_offset = ctx->fmt_offset % align_at;
      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
      if (ctx->struct_alignment == 0)
          ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
                                                                 ctx->is_complex);
    }
    if (type->size != size || type->typegroup != group) {
      if (type->typegroup == 'C' && type->fields != NULL) {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        ++ctx->head;
        ctx->head->field = type->fields;
        ctx->head->parent_offset = parent_offset;
        continue;
      }
      if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
      } else {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
      }
    }
    offset = ctx->head->parent_offset + field->offset;
    if (ctx->fmt_offset != offset) {
      PyErr_Format(PyExc_ValueError,
                   "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
      return -1;
    }
    ctx->fmt_offset += size;
    if (arraysize)
      ctx->fmt_offset += (arraysize - 1) * size;
    --ctx->enc_count;
    while (1) {
      if (field == &ctx->root) {
        ctx->head = NULL;
        if (ctx->enc_count != 0) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
        }
        break;
      }
      ctx->head->field = ++field;
      if (field->type == NULL) {
        --ctx->head;
        field = ctx->head->field;
        continue;
      } else if (field->type->typegroup == 'S') {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        if (field->type->fields->type == NULL) continue;
        field = field->type->fields;
        ++ctx->head;
        ctx->head->field = field;
        ctx->head->parent_offset = parent_offset;
        break;
      } else {
        break;
      }
    }
  } while (ctx->enc_count);
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  return 0;
}
static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
{
    const char *ts = *tsp;
    int i = 0, number, ndim;
    ++ts;
    if (ctx->new_count != 1) {
        PyErr_SetString(PyExc_ValueError,
                        "Cannot handle repeated arrays in format string");
        return NULL;
    }
    if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
    ndim = ctx->head->field->type->ndim;
    while (*ts && *ts != ')') {
        switch (*ts) {
            case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
            default:  break;
        }
        number = __Pyx_BufFmt_ExpectNumber(&ts);
        if (number == -1) return NULL;
        if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
            return PyErr_Format(PyExc_ValueError,
                        "Expected a dimension of size %zu, got %d",
                        ctx->head->field->type->arraysize[i], number);
        if (*ts != ',' && *ts != ')')
            return PyErr_Format(PyExc_ValueError,
                                "Expected a comma in format string, got '%c'", *ts);
        if (*ts == ',') ts++;
        i++;
    }
    if (i != ndim)
        return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
                            ctx->head->field->type->ndim, i);
    if (!*ts) {
        PyErr_SetString(PyExc_ValueError,
                        "Unexpected end of format string, expected ')'");
        return NULL;
    }
    ctx->is_valid_array = 1;
    ctx->new_count = 1;
    *tsp = ++ts;
    return Py_None;
}
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  int got_Z = 0;
  while (1) {
    switch(*ts) {
      case 0:
        if (ctx->enc_type != 0 && ctx->head == NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        if (ctx->head != NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        return ts;
      case ' ':
      case '\r':
      case '\n':
        ++ts;
        break;
      case '<':
        if (!__Pyx_Is_Little_Endian()) {
          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '>':
      case '!':
        if (__Pyx_Is_Little_Endian()) {
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '=':
      case '@':
      case '^':
        ctx->new_packmode = *ts++;
        break;
      case 'T':
        {
          const char* ts_after_sub;
          size_t i, struct_count = ctx->new_count;
          size_t struct_alignment = ctx->struct_alignment;
          ctx->new_count = 1;
          ++ts;
          if (*ts != '{') {
            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
            return NULL;
          }
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0;
          ctx->enc_count = 0;
          ctx->struct_alignment = 0;
          ++ts;
          ts_after_sub = ts;
          for (i = 0; i != struct_count; ++i) {
            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
            if (!ts_after_sub) return NULL;
          }
          ts = ts_after_sub;
          if (struct_alignment) ctx->struct_alignment = struct_alignment;
        }
        break;
      case '}':
        {
          size_t alignment = ctx->struct_alignment;
          ++ts;
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0;
          if (alignment && ctx->fmt_offset % alignment) {
            ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
          }
        }
        return ts;
      case 'x':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->fmt_offset += ctx->new_count;
        ctx->new_count = 1;
        ctx->enc_count = 0;
        ctx->enc_type = 0;
        ctx->enc_packmode = ctx->new_packmode;
        ++ts;
        break;
      case 'Z':
        got_Z = 1;
        ++ts;
        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
          return NULL;
        }
        CYTHON_FALLTHROUGH;
      case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
      case 'l': case 'L': case 'q': case 'Q':
      case 'f': case 'd': case 'g':
      case 'O': case 'p':
        if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
            (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
          ctx->enc_count += ctx->new_count;
          ctx->new_count = 1;
          got_Z = 0;
          ++ts;
          break;
        }
        CYTHON_FALLTHROUGH;
      case 's':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->enc_count = ctx->new_count;
        ctx->enc_packmode = ctx->new_packmode;
        ctx->enc_type = *ts;
        ctx->is_complex = got_Z;
        ++ts;
        ctx->new_count = 1;
        got_Z = 0;
        break;
      case ':':
        ++ts;
        while(*ts != ':') ++ts;
        ++ts;
        break;
      case '(':
        if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
        break;
      default:
        {
          int number = __Pyx_BufFmt_ExpectNumber(&ts);
          if (number == -1) return NULL;
          ctx->new_count = (size_t)number;
        }
    }
  }
}

/* BufferGetAndValidate */
  static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  if (unlikely(info->buf == NULL)) return;
  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  __Pyx_ReleaseBuffer(info);
}
static void __Pyx_ZeroBuffer(Py_buffer* buf) {
  buf->buf = NULL;
  buf->obj = NULL;
  buf->strides = __Pyx_zeros;
  buf->shape = __Pyx_zeros;
  buf->suboffsets = __Pyx_minusones;
}
static int __Pyx__GetBufferAndValidate(
        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
{
  buf->buf = NULL;
  if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
    __Pyx_ZeroBuffer(buf);
    return -1;
  }
  if (unlikely(buf->ndim != nd)) {
    PyErr_Format(PyExc_ValueError,
                 "Buffer has wrong number of dimensions (expected %d, got %d)",
                 nd, buf->ndim);
    goto fail;
  }
  if (!cast) {
    __Pyx_BufFmt_Context ctx;
    __Pyx_BufFmt_Init(&ctx, stack, dtype);
    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  }
  if (unlikely((size_t)buf->itemsize != dtype->size)) {
    PyErr_Format(PyExc_ValueError,
      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
    goto fail;
  }
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  return 0;
fail:;
  __Pyx_SafeReleaseBuffer(buf);
  return -1;
}

/* BufferFallbackError */
  static void __Pyx_RaiseBufferFallbackError(void) {
  PyErr_SetString(PyExc_ValueError,
     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
}

/* WriteUnraisableException */
  static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* RaiseNoneIterError */
  static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* PyErrExceptionMatches */
  #if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* PyObject_GenericGetAttrNoDict */
  #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
  #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

/* SetVTable */
  static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* PyObjectGetAttrStrNoError */
  static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
    }
#endif
    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
    if (unlikely(!result)) {
        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
    }
    return result;
}

/* SetupReduce */
  static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_getstate = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
    PyObject *getstate = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate);
#else
    getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate);
    if (!getstate && PyErr_Occurred()) {
        goto __PYX_BAD;
    }
#endif
    if (getstate) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate);
#else
        object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate);
        if (!object_getstate && PyErr_Occurred()) {
            goto __PYX_BAD;
        }
#endif
        if (object_getstate != getstate) {
            goto __PYX_GOOD;
        }
    }
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
            if (likely(reduce_cython)) {
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
            } else if (reduce == object_reduce || PyErr_Occurred()) {
                goto __PYX_BAD;
            }
            setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
                if (likely(setstate_cython)) {
                    ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                    ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                } else if (!setstate || PyErr_Occurred()) {
                    goto __PYX_BAD;
                }
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto __PYX_GOOD;
__PYX_BAD:
    if (!PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
    ret = -1;
__PYX_GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
    Py_XDECREF(object_getstate);
    Py_XDECREF(getstate);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* TypeImport */
  #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

/* Import */
  static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* ImportFrom */
  static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* FetchCommonType */
  static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CythonFunctionShared */
  #include <structmember.h>
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    Py_INCREF(m->func_qualname);
    return m->func_qualname;
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    if (unlikely(op == NULL))
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults_size = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
#if PY_MAJOR_VERSION < 3
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
#endif
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            PyErr_Format(PyExc_TypeError,
                         "unbound method %.200S() needs an argument",
                         cyfunc->func_qualname);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (unlikely(__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    m->defaults_size = size;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* CythonFunction */
  static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    PyObject *op = __Pyx_CyFunction_Init(
        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* ClassMethod */
  static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000
    if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) {
        return PyClassMethod_New(method);
    }
#else
#if CYTHON_COMPILING_IN_PYSTON || CYTHON_COMPILING_IN_PYPY
    if (PyMethodDescr_Check(method))
#else
    #if PY_MAJOR_VERSION == 2
    static PyTypeObject *methoddescr_type = NULL;
    if (methoddescr_type == NULL) {
       PyObject *meth = PyObject_GetAttrString((PyObject*)&PyList_Type, "append");
       if (!meth) return NULL;
       methoddescr_type = Py_TYPE(meth);
       Py_DECREF(meth);
    }
    #else
    PyTypeObject *methoddescr_type = &PyMethodDescr_Type;
    #endif
    if (__Pyx_TypeCheck(method, methoddescr_type))
#endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
        #if PY_VERSION_HEX < 0x03020000
        PyTypeObject *d_type = descr->d_type;
        #else
        PyTypeObject *d_type = descr->d_common.d_type;
        #endif
        return PyDescr_NewClassMethod(d_type, descr->d_method);
    }
#endif
    else if (PyMethod_Check(method)) {
        return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
    }
    else {
        return PyClassMethod_New(method);
    }
}

/* CalculateMetaclass */
  static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* Py3ClassCreate */
  static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* CLineInTraceback */
  #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
  static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
  #include "compile.h"
#include "frameobject.h"
#include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = NULL;
    PyObject *py_funcname = NULL;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_srcfile = NULL;
    py_srcfile = PyString_FromString(filename);
    if (!py_srcfile) goto bad;
    #endif
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        funcname = PyUnicode_AsUTF8(py_funcname);
        if (!funcname) goto bad;
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        if (!py_funcname) goto bad;
        #endif
    }
    #if PY_MAJOR_VERSION < 3
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    #else
    py_code = PyCode_NewEmpty(filename, funcname, py_line);
    #endif
    Py_XDECREF(py_funcname);  // XDECREF since it's only set on Py3 if cline
    return py_code;
bad:
    Py_XDECREF(py_funcname);
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_srcfile);
    #endif
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject *ptype, *pvalue, *ptraceback;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) {
            /* If the code object creation fails, then we should clear the
               fetched exception references and propagate the new exception */
            Py_XDECREF(ptype);
            Py_XDECREF(pvalue);
            Py_XDECREF(ptraceback);
            goto bad;
        }
        __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
    PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
    return -1;
}
static void __Pyx_ReleaseBuffer(Py_buffer *view) {
    PyObject *obj = view->obj;
    if (!obj) return;
    if (PyObject_CheckBuffer(obj)) {
        PyBuffer_Release(view);
        return;
    }
    if ((0)) {}
    view->obj = NULL;
    Py_DECREF(obj);
}
#endif


  /* CIntFromPyVerify */
  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* Declarations */
  #if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return ::std::complex< float >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return x + y*(__pyx_t_float_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      __pyx_t_float_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
  #if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        if (b.imag == 0) {
            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabsf(b.real) >= fabsf(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                float r = b.imag / b.real;
                float s = (float)(1.0) / (b.real + b.imag * r);
                return __pyx_t_float_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            float r = b.real / b.imag;
            float s = (float)(1.0) / (b.imag + b.real * r);
            return __pyx_t_float_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        if (b.imag == 0) {
            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            float denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_float_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrtf(z.real*z.real + z.imag*z.imag);
          #else
            return hypotf(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
            __pyx_t_float_complex z;
            float r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    float denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        return __Pyx_c_prod_float(a, a);
                    case 3:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(z, a);
                    case 4:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                } else if (b.imag == 0) {
                    z.real = powf(a.real, b.real);
                    z.imag = 0;
                    return z;
                } else if (a.real > 0) {
                    r = a.real;
                    theta = 0;
                } else {
                    r = -a.real;
                    theta = atan2f(0.0, -1.0);
                }
            } else {
                r = __Pyx_c_abs_float(a);
                theta = atan2f(a.imag, a.real);
            }
            lnr = logf(r);
            z_r = expf(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cosf(z_theta);
            z.imag = z_r * sinf(z_theta);
            return z;
        }
    #endif
#endif

/* Declarations */
  #if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return ::std::complex< double >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return x + y*(__pyx_t_double_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      __pyx_t_double_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
  #if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabs(b.real) >= fabs(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                double r = b.imag / b.real;
                double s = (double)(1.0) / (b.real + b.imag * r);
                return __pyx_t_double_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            double r = b.real / b.imag;
            double s = (double)(1.0) / (b.imag + b.real * r);
            return __pyx_t_double_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            double denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_double_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrt(z.real*z.real + z.imag*z.imag);
          #else
            return hypot(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
            __pyx_t_double_complex z;
            double r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    double denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        return __Pyx_c_prod_double(a, a);
                    case 3:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(z, a);
                    case 4:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                } else if (b.imag == 0) {
                    z.real = pow(a.real, b.real);
                    z.imag = 0;
                    return z;
                } else if (a.real > 0) {
                    r = a.real;
                    theta = 0;
                } else {
                    r = -a.real;
                    theta = atan2(0.0, -1.0);
                }
            } else {
                r = __Pyx_c_abs_double(a);
                theta = atan2(a.imag, a.real);
            }
            lnr = log(r);
            z_r = exp(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cos(z_theta);
            z.imag = z_r * sin(z_theta);
            return z;
        }
    #endif
#endif

/* CIntFromPy */
  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
  static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
                            return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (size_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            size_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* CIntFromPy */
  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* FastTypeChecks */
  #if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* CheckBinaryVersion */
  static int __Pyx_check_binary_version(void) {
    char ctversion[5];
    int same=1, i, found_dot;
    const char* rt_from_call = Py_GetVersion();
    PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    found_dot = 0;
    for (i = 0; i < 4; i++) {
        if (!ctversion[i]) {
            same = (rt_from_call[i] < '0' || rt_from_call[i] > '9');
            break;
        }
        if (rt_from_call[i] != ctversion[i]) {
            same = 0;
            break;
        }
    }
    if (!same) {
        char rtversion[5] = {'\0'};
        char message[200];
        for (i=0; i<4; ++i) {
            if (rt_from_call[i] == '.') {
                if (found_dot) break;
                found_dot = 1;
            } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') {
                break;
            }
            rtversion[i] = rt_from_call[i];
        }
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* InitStrings */
  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        if (PyObject_Hash(*t->p) == -1)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(b);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
    return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
#if PY_MAJOR_VERSION < 3
  } else if (likely(PyInt_CheckExact(o))) {
    return PyInt_AS_LONG(o);
#endif
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyInt_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
