Skip to content

Commit 545acbb

Browse files
committed
change strides to itemsize to fix multidiscrete bug
1 parent cbba3c2 commit 545acbb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

pufferlib/ocean/env_binding.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static PyObject* env_init(PyObject* self, PyObject* args, PyObject* kwargs) {
7171
return NULL;
7272
}
7373
env->actions = PyArray_DATA(actions);
74-
if (PyArray_STRIDE(actions, 0) == sizeof(double)) {
74+
if (PyArray_ITEMSIZE(actions, 0) == sizeof(double)) {
7575
PyErr_SetString(PyExc_ValueError, "Action tensor passed as float64 (pass np.float32 buffer)");
7676
return NULL;
7777
}
@@ -313,7 +313,7 @@ static PyObject* vec_init(PyObject* self, PyObject* args, PyObject* kwargs) {
313313
PyErr_SetString(PyExc_ValueError, "Actions must be contiguous");
314314
return NULL;
315315
}
316-
if (PyArray_STRIDE(actions, 0) == sizeof(double)) {
316+
if (PyArray_ITEMSIZE(actions, 0) == sizeof(double)) {
317317
PyErr_SetString(PyExc_ValueError, "Action tensor passed as float64 (pass np.float32 buffer)");
318318
return NULL;
319319
}

0 commit comments

Comments
 (0)