cythonで実装しようとしているのですが、エラーがでています
cythonで実装している部分以外のコードが多いので、最小限にしています
もしここがないとわからないということだったら説明をさせていただきます。
情報が少ないと思いますがよろしくお願いします。
python
1cython コード 2from math import exp 3cimport numpy as np 4ctypedef np.float64_t DTYPE_t 5 6def gamma(np.ndarray[DTYPE_t, ndim=1] word_all, np.ndarray[DTYPE_t, ndim=2] word_topic, float w_all, float w_topic): 7 cdef DTYPE_t c = exp(w_all+w_topic) / (sum([exp(wall + wtopic) for wall, wtopic in zip(word_all, word_topic)])) 8 return c 9 10------------------------------------------------- 11エラーがでている部分 12ga = np.prod([gamma(wo_all, wo_topic[z], wo_all[VOCA.index(wrd)], wo_topic[z][VOCA.index(wrd)]) for wrd in v]) 13 14エラー内容 15ValueError:buffer has wrong number of dimensions(expected 2, got 1)

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/08/10 04:17