liyaguang / DCRNN

Implementation of Diffusion Convolutional Recurrent Neural Network in Tensorflow
MIT License
1.19k stars 394 forks source link

Input 'b' of 'SparseTensorDenseMatMul' Op has type float32 that does not match type float64 of argument 'a_values'. #69

Closed xpf2333 closed 2 years ago

xpf2333 commented 3 years ago

Hi, when I use my data and adj_mx, this error happend, but i dont know what and where are the b and a_value. Thank you!

xpf2333 commented 3 years ago

TypeError: in converted code: relative to C:\Users\Administrator:

anaconda3\envs\tensorflow1.15\lib\site-packages\tensorflow_core\python\ops\rnn_cell_impl.py:1312 call
    cur_inp, new_state = cell(cur_inp, cur_state)
Desktop\许鹏飞的文件夹\DCRNN-master\model\dcrnn_cell.py:94 __call__
    value = tf.nn.sigmoid(fn(inputs, state, output_size, bias_start=1.0))
Desktop\许鹏飞的文件夹\DCRNN-master\model\dcrnn_cell.py:162 _gconv
    x1 = tf.sparse_tensor_dense_matmul(support, x0)
anaconda3\envs\tensorflow1.15\lib\site-packages\tensorflow_core\python\ops\sparse_ops.py:2405 sparse_tensor_dense_matmul
    adjoint_b=adjoint_b)
anaconda3\envs\tensorflow1.15\lib\site-packages\tensorflow_core\python\ops\gen_sparse_ops.py:3063 sparse_tensor_dense_mat_mul
    adjoint_b=adjoint_b, name=name)
anaconda3\envs\tensorflow1.15\lib\site-packages\tensorflow_core\python\framework\op_def_library.py:564 _apply_op_helper
    inferred_from[input_arg.type_attr]))

TypeError: Input 'b' of 'SparseTensorDenseMatMul' Op has type float32 that does not match type float64 of argument 'a_values'.
liyaguang commented 2 years ago

The a_value and b refers to the arguments in tf.sparse_tensor_dense_matmul(support, x0). It seems that one of the is float32, while another is float64. You may try to cast one of the to float32 with tf.cast: https://www.tensorflow.org/api_docs/python/tf/cast