9

I have considered these two posts(this and this), but they are not my problem and solution. I have the following code to create a feed forward network in tf:

step = 500
fromState = 0
toState = 5000000
numOfState = (toState - fromState) / step
numOfAction = 11

tf.reset_default_graph()
inputs1 = tf.placeholder(shape=[1,numOfState], dtype = tf.float32)
W = tf.Variable(tf.random_uniform([numOfState,4],0,0.01),)
Qout = tf.matmul(inputs1,W)
predict = tf.argmax(Qout,1)

However, I've got the following error in this line Qout = tf.matmul(inputs1,W):

TypeError: DataType float32 for attr 'T' not in list of allowed values: int32, int64

Apparently everything is ok, but the question is what is this error and where does it come from?

1
  • Just keep ints : (toState - fromState) // step Commented Oct 29, 2017 at 19:58

1 Answer 1

4

I have found the problem. The problem comes from numOfState. As I have found its type is float32. Hence, the problem is solved by casting this variable to int:

#numOfState = (toState - fromState) / step 
# change to
numOfState = int((toState - fromState) / step)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.