Skip to content

Error in Recurrent Neural Networks in Tensorflow I #1

@favetelinguis

Description

@favetelinguis

Getting the following problem using TF 1.0 and Py 3.6, any idea why, must be related with TF version?

`

TypeError Traceback (most recent call last)
in ()
4 for rnn_input in rnn_inputs:
5 print(type(state))
----> 6 state = rnn_cell(rnn_input, state)
7 rnn_outputs.append(state)
8 final_state = rnn_outputs[-1]

in rnn_cell(rnn_input, state)
11 W = tf.get_variable('W', [num_classes + state_size, state_size])
12 b = tf.get_variable('b', [state_size], initializer=tf.constant_initializer(0.0))
---> 13 return tf.tanh(tf.matmul(tf.concat(1, [rnn_input, state]), W) + b)
14
15 def drl_cell(f, u, last_action):

/Users/henke/anaconda2/envs/udacity/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py in concat(values, axis, name)
1045 ops.convert_to_tensor(axis,
1046 name="concat_dim",
-> 1047 dtype=dtypes.int32).get_shape(
1048 ).assert_is_compatible_with(tensor_shape.scalar())
1049 return identity(values[0], name=scope)

/Users/henke/anaconda2/envs/udacity/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in convert_to_tensor(value, dtype, name, preferred_dtype)
649 name=name,
650 preferred_dtype=preferred_dtype,
--> 651 as_ref=False)
652
653

/Users/henke/anaconda2/envs/udacity/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in internal_convert_to_tensor(value, dtype, name, as_ref, preferred_dtype)
714
715 if ret is None:
--> 716 ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
717
718 if ret is NotImplemented:

/Users/henke/anaconda2/envs/udacity/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py in _constant_tensor_conversion_function(v, dtype, name, as_ref)
174 as_ref=False):
175 _ = as_ref
--> 176 return constant(v, dtype=dtype, name=name)
177
178

/Users/henke/anaconda2/envs/udacity/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py in constant(value, dtype, shape, name, verify_shape)
163 tensor_value = attr_value_pb2.AttrValue()
164 tensor_value.tensor.CopyFrom(
--> 165 tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
166 dtype_value = attr_value_pb2.AttrValue(type=tensor_value.tensor.dtype)
167 const_tensor = g.create_op(

/Users/henke/anaconda2/envs/udacity/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py in make_tensor_proto(values, dtype, shape, verify_shape)
365 nparray = np.empty(shape, dtype=np_dt)
366 else:
--> 367 _AssertCompatible(values, dtype)
368 nparray = np.array(values, dtype=np_dt)
369 # check to them.

/Users/henke/anaconda2/envs/udacity/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py in _AssertCompatible(values, dtype)
300 else:
301 raise TypeError("Expected %s, got %s of type '%s' instead." %
--> 302 (dtype.name, repr(mismatch), type(mismatch).name))
303
304

TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions