Skip to content

bidirectional_rnn.ipynb error #1

@mrubashkin-svds

Description

@mrubashkin-svds

When running the def BiRNN(x, weights, biases) cell with nothing changed in the code from the repository, I get the following error (I tried some quick fixes, but would love some advice on how to fix):

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py in apply_op(self, op_type_name, name, **keywords)
    489                 as_ref=input_arg.is_ref,
--> 490                 preferred_dtype=default_dtype)
    491           except TypeError as err:

/usr/local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py in convert_to_tensor(value, dtype, name, as_ref, preferred_dtype)
    668         if ret is None:
--> 669           ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
    670 

/usr/local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py in _TensorTensorConversionFunction(t, dtype, name, as_ref)
    582         "Tensor conversion requested dtype %s for Tensor with dtype %s: %r"
--> 583         % (dtype.name, t.dtype.name, str(t)))
    584   return t

ValueError: Tensor conversion requested dtype int32 for Tensor with dtype float32: 'Tensor("Reshape_3:0", shape=(?, 28), dtype=float32)'

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
<ipython-input-7-795f6f262cc6> in <module>()
     29     return tf.matmul(outputs[-1], weights['out']) + biases['out']
     30 
---> 31 pred = BiRNN(x, weights, biases)
     32 
     33 # Define loss and optimizer

<ipython-input-7-795f6f262cc6> in BiRNN(x, weights, biases)
     10     x = tf.reshape(x, [-1, n_input])
     11     # Split to get a list of 'n_steps' tensors of shape (batch_size, n_input)
---> 12     x = tf.split(x, n_steps, 0)
     13 
     14     # Define lstm cells with tensorflow

/usr/local/lib/python3.5/site-packages/tensorflow/python/ops/array_ops.py in split(split_dim, num_split, value, name)
   1232                               num_split=num_split,
   1233                               value=value,
-> 1234                               name=name)
   1235 
   1236 

/usr/local/lib/python3.5/site-packages/tensorflow/python/ops/gen_array_ops.py in _split(split_dim, value, num_split, name)
   3239   """
   3240   result = _op_def_lib.apply_op("Split", split_dim=split_dim, value=value,
-> 3241                                 num_split=num_split, name=name)
   3242   return result
   3243 

/usr/local/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py in apply_op(self, op_type_name, name, **keywords)
    506             if input_arg.type != types_pb2.DT_INVALID:
    507               raise TypeError("%s expected type of %s." %
--> 508                               (prefix, dtypes.as_dtype(input_arg.type).name))
    509             else:
    510               # Update the maps with the default, if needed.

TypeError: Input 'split_dim' of 'Split' Op has type float32 that does not match expected type of int32.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions