を整数に型tensorvariableのスライスエントリを強制しないと、私はフォーラムや運を検索はIndexError:「debugf.py ipython」私は実行
IndexError Traceback (most recent call last)
/home/ml/debugf.py in <module>()
8 fff = theano.function(inputs=[index],
9 outputs=cost,
---> 10 givens={x: train_set_x[index: index+1]})
IndexError: failed to coerce slice entry of type TensorVariable to integer"
以下のように、それは私にエラーメッセージを与え、誰かがそこにできています助けて ?感謝! ありがとう!
debugf.py:
import theano.tensor as T
import theano
import numpy
index =T.lscalar()
x=T.dmatrix()
cost=x +index
train_set_x=numpy.arange(100).reshape([20,5])
fff=theano.function(inputs=[index],
outputs=cost,
givens={x:train_set_x[index: index+1]}) #<--- Error here
投稿の冒頭に何か不足しているようです。あなたはIndexErrorを与えましたか?あなたが 'cost = x [index:index + 1] + index'と単純に' givens = {x:shared_x} 'を置くと、 – Anthon