2017-10-29 40 views
1

,我从github代码类型,并在遇到以下行错误:TensorFlow版本1.3.0 - 的“分裂”运算输入“split_dim”有型FLOAT32不符合预期的INT32

# Split the series because the rnn cell needs time_steps features, each of shape: 
hidden = tf.split(0, config.n_steps, feature_mat) 
print (len(hidden), str(hidden[0].get_shape())) 
# New shape: a list of lenght "time_step" containing tensors of shape [batch_size, n_hidden] 

的错误信息是:

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

我已经看到了在计算器上类似的问题,这个问题是由于tensorflow的过时的版本,但我tensorflow的版本是1.3。

+0

您是否尝试过换'feature_mat'和'0'为[这](https://stackoverflow.com/a/41868500/5200287)答案提示? – gommb

+0

是的,这是非常有帮助!谢谢! – user97t9q8w98r55203

回答

0

其实,这是因为你使用的是旧版本的tf.split。修改代码如下,并应工作。

hidden = tf.split(feature_mat, config.n_steps, 0) 

希望这会有所帮助。

+0

非常感谢您!现在,该代码运行完全。 – user97t9q8w98r55203

相关问题