Theano 'Expected An Array-like Object, But Found A Variable': Using Scan & Categorical_crossentropy
I'm trying to sum multiple loss in theano but I can't make it work. I'm using the categorical crossentroy. Here is my code: import numpy as np import theano import theano.tenso
Solution 1:
I found my problem, it's really a stupid one.
loss = loss_cal(answers, predictions)
This is wrong, as predictions is the theano matrix, I should have been using pred
.
pred = []
for i in range(0, max_nbr):
temp = np.ones(8)
temp[i] = temp[i] + 5
temp = temp/sum(temp)
pred.append(temp)
It works now with
loss = loss_cal(answers, pred)
Thanks anyway
Post a Comment for "Theano 'Expected An Array-like Object, But Found A Variable': Using Scan & Categorical_crossentropy"