jupyterでcythonのコードを書きましたが、型が違うと出ます。
ValueError: Buffer dtype mismatch, expected 'DTYPE_t' but got 'long'
%%cython import numpy as np cimport numpy as np cimport cython ctypedef np.float64_t DTYPE_t def hoge(): cdef np.ndarray[DTYPE_t, ndim=1] arg arg = np.arange(0, 7, 1) hoge()
そこで、
最後の方を
arg = np.arange(0, 7, 1, dtype = 'float64')
としたらエラーが出なくなりました。float64はDTYPE_tではないのになぜエラーが出ないのでしょうか。
あなたの回答
tips
プレビュー